OpenGL state management

Trending 2 years ago

I americium moving connected a package pinch tons of different shaders, which require different states successful OpenGL. My problem is nan following: The different models pinch different shaders are not rendered successful nan aforesaid order, truthful location is simply a move shape shader1 to shader23 to shader2 and truthful on. In nan adjacent framework this bid tin alteration (depending connected nan scenario). When I americium adding a caller benignant of entity (with caller shader and truthful on) and I deliberation it is working, I request to cheque each bid of object-rendering to see, if bugs appear. With bugs I mean OpenGL states which are group to a circumstantial worth and later not changed back. How do you grip this?

I person nan idea, to create a OpenGL authorities people wherever you tin specify each parameter. When moving an render method, nan existent authorities will beryllium compared pinch nan OpenGL authorities and each mounting which is different should beryllium group to nan authorities will is required for this rendering.

This seems to maine much than a fewer lines of code... The astir hardest portion is to fig retired which states are saved successful which OpenGL array (with array I mean VAO, FBO, Texture, ...). Where tin I find a array very bully described wherever each OpenGL authorities will beryllium saved?

I mean: erstwhile binding Shader1 and mounting azygous "test" to worth "123" and past binding Shader2, nan azygous location besides named "test" will not person nan worth "123"... truthful nan azygous values are someway stored connected shader level?? Same pinch attributepointer and VAO...

On nan different hand: PointSize is not stored connected shader level... truthful each clip I americium rendering Points, I request to cheque which size they person and alteration it to nan required size.

Can personification springiness maine immoderate URL to a array of OpenGL states?

Does personification has a amended thought to grip this problem? BTW: I americium not nan only 1 who is moving connected this software... truthful saying "every clip erstwhile changing a state, alteration it backmost astatine nan extremity of nan method" will not work.

More
close