Added CMake support for specifying what OpenGL target and features that the OpenSceneGraph build should use.

Added use of the new Cmake generated #define's for optionally compiling parts of the OpenSceneGraph's OpenGL support for the various OpenGL targets
This commit is contained in:
Robert Osfield
2009-10-23 13:19:57 +00:00
parent 023fb109a3
commit 327b67a305
26 changed files with 174 additions and 32 deletions

View File

@@ -99,10 +99,9 @@ void Light::setLightNum(int num)
}
}
void Light::captureLightState()
{
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_AMBIENT, _ambient.ptr() );
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_DIFFUSE, _diffuse.ptr() );
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPECULAR, _specular.ptr() );
@@ -113,10 +112,14 @@ void Light::captureLightState()
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_CONSTANT_ATTENUATION, &_constant_attenuation );
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_LINEAR_ATTENUATION, &_linear_attenuation );
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_QUADRATIC_ATTENUATION, &_quadratic_attenuation );
#else
osg::notify(osg::NOTICE)<<"Warning: Light::captureLightState() - not supported."<<std::endl;
#endif
}
void Light::apply(State&) const
{
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_AMBIENT, _ambient.ptr() );
glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_DIFFUSE, _diffuse.ptr() );
glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPECULAR, _specular.ptr() );
@@ -127,4 +130,7 @@ void Light::apply(State&) const
glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_CONSTANT_ATTENUATION, _constant_attenuation );
glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_LINEAR_ATTENUATION, _linear_attenuation );
glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_QUADRATIC_ATTENUATION, _quadratic_attenuation );
#else
osg::notify(osg::NOTICE)<<"Warning: Light::apply(State&) - not supported."<<std::endl;
#endif
}