• Advertisement
Sign in to follow this  

Lighting + Color

This topic is 3706 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When i use lighting, it overrides my glColor3f();, and shows white to black only. Is there a way to use lighting with glColor3f();

Share this post


Link to post
Share on other sites
Advertisement
Write "glEnable(GL_COLOR_MATERIAL);" and look up the use of "glColorMaterial" to have the material colour track the current drawing colour.

Share this post


Link to post
Share on other sites
Or the simpliest way is to use parameter glMaterialf (or glMaterialfv)!
There are few types of material:
glMaterialfv(first parameter, second parameter, float variable[]);
first parameter can be GL_FRONT (just front faces directing to light), GL_BACK (just back faces) or GL_FRONT_AND_BACK (front and back faces)
second parameter can be GL_DIFFUSE, GL_SPECULAR, GL_EMISSION, GL_AMBIENT and GL_SHININESS (but if you write shininess, next value must be just one float! and it's written by glMaterialf (NOT glMaterialfv), another parameters-> 4 floats in variable).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement