I have found various resources about setting modes for light in OSG. But I do not want to use setMode(), but getMode(), which is giving me some problems.
I want to issue a command like the OpenGL "glIsEnabled(GL_LIGHT0)" to see if a certain light is already active. This is needed to find a "free" light number to enable a new light besides the one already in the scene. The thing is, the return value from my getMode() command is always "8"! Any help is greatly appreciated. Here is a code fragment: osg::StateSet* rootStateSet = root->getStateSet(); int lightNum = 0; osg::StateAttribute::GLModeValue attr = rootStateSet->getMode(GL_LIGHT0); if(attr==0) { lightNum = 0; } else { attr = rootStateSet->getMode(GL_LIGHT1); if(attr==0) { lightNum = 1; } else { attr = rootStateSet->getMode(GL_LIGHT2); if(attr==0) { lightNum = 2; } else { attr = rootStateSet->getMode(GL_LIGHT3); if(attr==0) { lightNum = 3; } } } } ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org