Robert Osfield wrote on Friday, February 20, 2009 9:56 AM: > Curious little titbit. When you say you could access GL_LIGHTING > state, do you mean the GL_LIGHTING mode, or the glLight associated > uniforms? > > I haven't come across modes being exposed as built in uniforms in > GLSL, and my own pondering I have always assumed that fixed function > pipeline modes would map to enable/disable of shaders (such as a > texgen computation) and their associated entries in the main that > include their usage. Given this context I was expecting to have to do > some high level shader composition (i.e. in our C++ code) using modes > as a guide to know which shaders to include in the vertex/fragment > main shaders. It may be possible to use #define's and #ifdef's to > replicate some of this mode support, but have to admit I haven't > explored this part of GLSL yet.
I think he means the GL_LIGHTING mode; the light parameters (diffuse ambient specualr colors, position, etc.) are certainly available, but there is no way to tell if the application has enabled GL_LIGHTING within GLSL. You'd have to do high level shader composition, #defines, or a uniform, as you and Bill suggest. > On Fri, Feb 20, 2009 at 3:39 PM, Bill Prendergast <[email protected]> wrote: >> Robert, >> >> Just a nuisance tidbit that I recently wrestled with... it appears there >> are some things in the FFP that you can't get at via GLSL (at present). >> >> I tried to get at the GL_LIGHTING state from within the shader and couldn't >> access it. I asked around a little and was told that GL_LIGHTING "and some >> other states" are available to the FFP functions, but not the shader. >> (I never followed up on what "other states" were included). >> >> So a "generic" shader that emulates FFP would need to test GL_LIGHTING >> and if OFF, perform the non-shaded coloring and return. To get this, you'll >> need a little help in the software side. >> >> For example, a visitor that removed the shader or used a different shader >> when GL_LIGHTING was off, or (the manner I chose), to create a uniform that >> tracked the GL_LIGHTING state to emulate that. >> >> Regards, >> Bill >> >> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g >> > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g -- Bryan Thrall FlightSafety International [email protected] _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

