1) glGetIntegerv, glGetFloatv, etc. These don't have to interact with the graphics card, right? So these are near "instant" and close to free? My guess is yes.2) I do glEnable (GL_ALPHA_TEST). It was already on. Can I expect the driver to ignore this since it is redundant? My guess is yes or doesn't materially matter.

I worry about some of this stuff being left on accidentally (forgot to turn something off in code or restore it) and in the past, I've had to track down a couple of places where something "wasn't right" and then find where something wasn't restored.

If I check the state of every GL capability I care about (probably 20 of them at most) before drawing an entity, is that going to affect performance? My guess is no because even if it did, say, 6000 glGetFloatv/glGetIntegerv per frame the speeds are similar to any other external library simple function call.

Now I probably plan to #ifdef _DEBUG this anyway so it is only in the debug build.

The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..

1: glGet* are not expected to be particuarly optimised. You're expected to be tracking any such state yourself, which removes the need for any such calls mid-frame.2: you're still thunking through at least two different dlls. in cpu cache terms alone, that's quite significant, more so than a simple statically linked lib. If you're changing textures at the same time then its *probably* not otherwise significant.

By all means use glGet to query implementation-defined limits, or in debug builds. Just don't rely upon it because its basically pointless to do so. It will nearly always be faster to directly store the current value somewhere than to go through thunks to query it.

This stuff is all cpu stuff, rather than any intrinsic hardware stuff. CPU optimisation rules apply.I'm not even sure drivers will actually see any of those gl enums.

I'm trying to actually strip all the glEnable / glDisable and friends out of the code in favor of specifying "Ok, this is the drawing state for X ... " and then comparing the current engine-tracking idea of what the states are versus the new states and changing what needs to be changed.

The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..

The driver may or may not cache values for glGet calls locally; if it does then it shouldn't need to round-trip to the GPU, if it doesn't then it will, but it depends on the driver and todays driver behaviour may be completely different tomorrow. So don't depend on it.

We had the power, we had the space, we had a sense of time and placeWe knew the words, we knew the score, we knew what we were fighting for