View Full Version : Smooth shading failure - help

09-15-2009, 10:22 AM
We have a CAD program, GUI in 'C', graphics in OpenGL. When rendering our models they can be wireframe, shaded (flat), or shaded (smooth).

Color for the shading is in a "resource" file and can be specified by changing the attribute *colorShade to what ever you desire.

However, in the rendering, when you select "Smooth Shade" the model is ALWAYS rendered in "pink" even though the FLAT shading has been specified as dodgerBlue. How do I get something other than "pink" for the Smooth shading?

09-15-2009, 11:15 AM
I found it -

from: http://www.opengl.org/resources/faq/technical/lights.htm

Lighting does not work with the current color as set by glColor*(). It works with material colors. Set the material colors with glMaterial*(). Material colors can be made to track the current color with the color material feature. To use color material, call glEnable(GL_COLOR_MATERIAL). By default, this causes ambient and diffuse material colors to track the current color. You can specify which material color tracks the current color with a call to glColorMaterial().

Adding glEnable(GL_COLOR_MATERIAL) fixed it.

09-15-2009, 03:17 PM
Thanks for reporting that back to us Art. Didn't know about GL_COLOR_MATERIAL. Could have used it in the past.