-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
globjects poses a very interesting matter about the opengl state
From their readme
"
State
OpenGL state is wrapped as States, StateSettings and Capabilities, where the latter two are mainly used internally.
auto currentState = State::currentState(); // full current state; usable for resetting
auto state1 = new State(State::ImmediateMode); // all changes are applied immediately
state1->enable(GL_RASTERIZER_DISCARD); // Configuring a Capability
state1->primitiveRestartIndex(static_cast<GLuint>(-1)); // Configuring a StateSetting
auto state2 = new State(State::DeferredMode); // changes has to be applied explicitly
state2->pointSize(10.0f);
state2->apply();
currentState->apply(); // Reset manipulated state
I like the idea to have a determined place where we can set important variables. In the sample he uses ImmediateMode, but I'm thinking more about using DSA (Direct State Access) or not. Atm DSA is just a top variable to say..
Also, sometimes, for debug purposes, I always missed a confortable way to reset the whole current gl state in a specific point.
Having something like state::reset
looks wonderful under this point of view..