PDA

View Full Version : Where can i read managing OpenGL state



lummxx
12-26-2015, 04:06 PM
Hi,

I am working on a small render engine again. This time I will change some things from the previous one and epxeriment with them to see what results I will get. One thing i would like to experiment is on creating a class where i keep my current opengl state so that when i go though the rendere pipleine i will know what state i am and then what i should turn on and off to render things in the next stage. I am planning to upload the code tomorrow after i fix some things. Its the first time i am coding in Linux and i have to get used to the enviorment a bit (so far its fun).

Is there any good tutorial that i can read, any chapter in a book, or any thread in the forum. I am not trying to complicate things a lot.

For now the goal is to have a simple PBR renderer with few light types and deecent shadows. Then i will see how can i make it more pretty iwth post processing :D

Merry Christmas.

Dark Photon
12-26-2015, 08:07 PM
One thing i would like to experiment is on creating a class where i keep my current opengl state so that when i go though the rendere pipleine i will know what state i am and then what i should turn on and off to render things in the next stage.
Could you explain a bit more what you're wanting to do here? Do you just want to keep track of what the current state is so you can remove duplicate state changes and print out the current state? If so, you should be able to do that pretty easily with pass-through methods that record the active state on set.

Also keep in mind that for debug purposes, you can query the current state from OpenGL. However, you should not do so when you're aiming for good performance.

lummxx
12-27-2015, 03:41 PM
Yes something like that, a class where i would keep the current state.

The idea is to keep the track of current state and when I want to change the state I first change the state in that class then I call that class, get the state and render. So a class where I keep the state instead of querring opengl. Just trying to simplify things before i start writing the render class for PBR. I am planing implement and see how a deffered rendering work and then implement PBR shader.

I just found something but this looks too complicated for me now.

* /sdl2-gamedev/src/.../src/ui/GlState.h... (https://bitbucket.org/swarminglogic/sdl2-gamedev/src/38e1c2747271cda783500372f61b9209068ee437/src/ui/GlState.h?at=master&fileviewer=file-view-default)