Hello Johannes, On 12/10/2010 03:28 AM, Johannes Brunen wrote: >>> I thought that I would have full GL state infromation inside of a shader >>> program. >> >> no, you can access all the lights properties (position, color, etc.) >> through the gl_LightSource[i] built in uniform, but the piece of >> information that is crucially missing is if the light is actually >> enabled (i.e. if glEnable(GL_LIGHTi) was called). > > Unbelievable. Then this information must be provided by addional uniforms. > Correct?
yes, for lights OpenSG actually does that, the uniforms are called OSGLightNActive with N = 0..7. in the GLSL code you just put: uniform int OSGLightNActive; and on your fragment shader object you call: ShaderProgramRefPtr fp = ShaderProgram::createFragmentShader(); fp->addOSGVariable("OSGLightNActive"); There are some other useful "built in" uniforms like that, see Source/System/State/Shader/Variables/OSGShaderVariableOSG.h for a list. Cheers, Carsten ------------------------------------------------------------------------------ _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users