Smooth shading failure - help

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?

I found it -


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.

Thanks for reporting that back to us Art. Didn’t know about GL_COLOR_MATERIAL. Could have used it in the past.