PDA

View Full Version : Casting Light onto Textures



ltrain_riders
12-05-2002, 07:15 PM
When you create lights in OpenGL and have a textured object, isn't the texture suppose to be lit? When I turn the textures off, my objects have different shades of light on their faces, but with textures turned on they do not show this.

yakuza
12-05-2002, 07:30 PM
Have you set material properties? Look at glMaterialfv if you haven't.

How about have you tried moving the light position, so you can see the effect of the light as it moves over the object? Look at glLightfv(GL_LIGHT0, GL_LIGHT_POSITION, position[])

How about normals specified for each vertex?

Hopefully one of those is problem. http://www.opengl.org/discussion_boards/ubb/smile.gif

vincoof
12-06-2002, 01:05 AM
You problem may appear if you have called glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE).

By "no shade of light", do you mean that you can see the texture ? or is the texture black or have weird colors ?

Relic
12-06-2002, 01:06 AM
Check the glTexEnv setting.
Default is GL_MODULATE and what you expected. GL_DECAL will result in the pure texture colors, what your described.