perandersson / pogl Goto Github PK
View Code? Open in Web Editor NEWAn Object-Oriented Multithread-friendly framework for OpenGL 3.3
License: MIT License
An Object-Oriented Multithread-friendly framework for OpenGL 3.3
License: MIT License
When drawing a vertex buffer onto the screen, glDrawArrays results into an GL_INVALID_OPERATION error if the same vertex buffer has been bound on another (shared) context.
The result, when running in Release Mode, looks like it's flimmering (Works at random times).
The specification allows mapping of different types at the same time. Example:
void* vertexBufferPtr = glMapBuffer(GL_ARRAY_BUFFER);
void* indexBufferPtr = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER);
glUnmap(GL_ELEMENT_ARRAY_BUFFER);
glUnmap(GL_ARRAY_BUFFER);
This also measn that the current deferred solution will not work with this solution a.t.m.
One interesting idea would be to allow the developer to manually specify the binding point of the resource.
Decide what to do regarding binding buffers.
Example (psuedo code):
BindVertexBuffer();
BindIndexBuffer();
Draw();
BindVertexBuffer();
Draw();
Show the index buffer from the first draw command still be bound?
Add support for framebuffers:
class IPOGLFramebuffer;
Create framebuffer usage:
// Create a framebuffer that renders to the following textures. The index in the
// textures array defines the color location used in the fragment shader
IPOGLTexture* textures[] = { texture0, texture1 }
// Create a framebuffer with the two textures above and a depth texture
IPOGLFrameBuffer* fb = context->CreateFramebuffer(textures, 2, depth);
// Release the textures if you do not need them anymore
texture0->Release(); texture1->Release(); depth->Release();
Render to the framebuffer:
// Set framebuffer
renderState->SetFramebuffer(fb);
// Unset framebuffer
renderState->SetFramebuffer(nullptr);
Use framebuffer textures inside the fragment shader:
// Retrieve the texture at the given index
IPOGLTexture* texture = fb->GetTexture(0);
// Set the uniform
renderState->GetUniformByName("texture")->SetTexture(texture);
// Release the texture reference counter
texture->Release();
Changes made on Uniforms retrieved from the POGLProgram
instance is supplied to OpenGL directly if the program is applied. This is not the expected behaviour.
Changing uniform values and applying them in OpenGL directly should only be possible from the POGLRenderState
.
Possible solutions are:
IsProgramApplied
method and wrap the returned uniform in a POGLRenderState
specific uniform for the currently applied program.FindUniformByName
and FindDefaultUniformByName
Add support for assigning POGL_SIZE and POGL_RECT uniform values:
void IPOGLUniform::SetSize(const POGL_SIZE& size);
void IPOGLUniform::SetRect(const POGL_RECT& rect);
Add support for resizing textures
Add support for a provider-like API for the internal parts of POGL. Example of such providers are:
class IPOGLBufferProvider;
class IPOGLTextureProvider;
Changed the linked-list solution into an array solution where we use realloc and array index as command marker.
All buffer mapping is "unsafe" at the moment, i.e. GL_MAP_UNSYNCHRONIZED_BIT is used for glMapBufferRange and GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD is used for buffers on AMD-chipset.
All OpenGL calls are always made from the main thread (where the immediately render context lives). So I'm not sure if this approach is necessary for the GL_MAP_UNSYNCHRONIZED_BIT since the mapping is not made until the command been processed by the OpenGL command queue.
The GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD requires it however, since we don't put the new data onto the OpenGL command queue to be transferred.
Copying buffers should include:
Implement Mac variant of the Device- and DeviceContext classes
Add a simplified mathematical library for POGL. Example:
POGL_MAT4F viewMatrix;
POGLXPerspective(near, far, fov, ratio, &viewMatrix);
The following features should be available:
POGLXLookAt(const POGL_VEC3F& eye, const POGL_VEC3F& center, const POGL_VEC3F& up, POGL_MAT4F* matrix)
Also rename IPOGLDeferredDeviceContext into IPOGLDeferredRenderContext
It's impossible to completely prevent unneccessary commands (state changes) in the command queue. But we can make an assumptions that prevents some of them:
We know that all the commands in the command queue for the same deferred render context will be called in the same order as they are generated
Implement Linux variant of the Device- and DeviceContext classes
When more than two contexts are bound at the same time, wglMakeCurrent fails when starting the application on the second monitor
Although quite unusual, but the IPOGLDeferredDeviceContext increase the reference counter of the IPOGLVertexBuffer instances more than releases them when the thread closing down and the IPOGLDeferredDeviceContext being released, but still has commands on the queue.
Support for setting uniform values when performing rendering in a thread
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.