Robert, I've used the "uber shader, #define, #ifdef" approach. The shader has all the code, but none of the #defines. I store the specific mode/state information in the osg node descriptions and use it to set the appropriate uniforms and #defines for compiling the shader. It's messy.
Brian This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. • [email protected] wrote: ----- To: OpenSceneGraph Users <[email protected]> From: Robert Osfield <[email protected]> Sent by: [email protected] Date: 02/20/2009 10:56AM Subject: Re: [osg-users] Fixed function pipeline -> GLSL shaders HI Bill, 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. Robert. 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.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

