don't setup normals if lighting is off

This commit is contained in:
Chris Danford
2004-04-16 18:38:43 +00:00
parent 202c37ce44
commit 1a182e8f4e
+12
View File
@@ -1141,6 +1141,12 @@ public:
glTexCoordPointer(2, GL_FLOAT, 0, NULL);
// AssertNoGLError();
// TRICKY: Don't bind and send normals if lighting is disabled. This
// will save some effort transforming these values.
GLboolean bLighting;
glGetBooleanv( GL_LIGHTING, &bLighting );
if( bLighting )
{
glEnableClientState(GL_NORMAL_ARRAY);
GLExt::glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nNormals );
// AssertNoGLError();
@@ -1149,6 +1155,12 @@ public:
GLExt::glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_nTriangles );
// AssertNoGLError();
}
else
{
glDisableClientState(GL_NORMAL_ARRAY);
}
#define BUFFER_OFFSET(o) ((char*)(o))