State access

Hi!

I am wondering how it is possible to access OpenGL State variables that were normally enabled/disabled via the standard glEnable/glDisable functions.

Namely these are GL_FOG and GL_LIGHTING (and GL_LIGHTn…)

If this is not possible, what is the best way to handle this access? I assume handling it via an uniform variable passed to the specific vertex/fragment programs may be the easiest way.

Whats up with passing the data when compiled into a display list? When setting an uniform variable while compiling a display list, is it passed/changed when the display list is called?

Thanks,
Thomas

I see no one replied your post. It’s simply because everything you need is described in glslang specs in section 7.5.
All OpenGL state variables are accessible as uniforms.
Always look for such information in specs first. This will save you some time since you will not have to wait for someone to answer.

k_szczech: Thanks for your reply. I had a quick look into the spec again. Sorry, but the information i need is not there.

To clarify things: i know the built-in variables that give me all the information i need. But what’s with the state itself? For example: I enable GL_FOG, so, how should i tell my shader if fogging is enabled? This is the intention of my original post. Maybe it is somewhere in the documentation, but then i don’t know where to find it. Can someone point me in the right direction?

I worked with GLSL for a couple of projects now (mostly postprocessing, though). Can someone please remove FFP completely out of my head?! :wink:

Thanks,

Thomas

i dont think it is possible ( i havent looked to be honest but )
u will have to supply the info yourself
eg
bool lighting_state = glIsEnabled( GL_LIGHTING ); // or whatever the func is

and then set lighting_state as a uniform to access dueing the program

Zed,

thank you for your information. This is what i already assumed… I’m going to port a complete fixed render pipeline to GLSL (due to new requirements to the engine) and all states are compiled into display lists… i believe this will be very funny the next days :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.