Lighting + Color

Started by
2 comments, last by Vilem Otte 16 years, 3 months ago
When i use lighting, it overrides my glColor3f();, and shows white to black only. Is there a way to use lighting with glColor3f();
Advertisement
Yeah, there's some nice solution to this - first using GL_ARB_texture_env_combine extensions and GL_ARB_multitexture extensions and second using GLSL shader programming.

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

Write "glEnable(GL_COLOR_MATERIAL);" and look up the use of "glColorMaterial" to have the material colour track the current drawing colour.
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).

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

This topic is closed to new replies.

Advertisement