another stupid question from me: When using material properties (ambient, diffuse, specular) and specifiying them separatly with glMaterial, the performance of my app is extremely slow (rendering a terrain with some 100.000 triangles). However, when enabling GL_COLOR_MATERIAL and using glColor instead of glMaterial, it speeds up dramatically… running absolutely smooth and fast, compared to nearly “standbilder” with glMaterial. It’s obvious that it gets faster because of less calls to set the color, but that does not explain this extremely big difference in performance. I guess that other things that happen inside OpenGL are also different with GL_COLOR_MATERIAL enabled? A whole different/simpler lightnig model without specular highlights?


your right, lighting = lighting calculations.

if you want to speed up the app and still use your lighting effects, look into frustum culling to avoid rendering what cant be seen.

Are you using the glMaterial calls between a begin/end? If I remember correctly, there was a discussion once on the advanced boards about it being more efficient to use glColor with GL_COLOR_MATERIAL enabled if you needed to change material properties between a glBegin/glEnd.

The color calls are not between glbegin and glend. And I am not sure if lightning calculations are less complex with GL_COLOR_MATERIAL, I would rather think that enabling this simply changes the way material properties are specified, and not the way OpenGL internally calculates the lighning.

And the idea about frustum culling is surely a good one, so convincing that we have this in the app since 1999 .


Yeah, GL_COLOR_MATERIAL only changes how you specify material properties. It shouldn’t be changing the way lighting is calculated.