PDA

View Full Version : Lighting&Texture Mapping



Sam Kovalev
11-08-2004, 03:23 AM
Hi, my name is Sam.I have a problem.
I dont know how to enable lighting using texture mapping at the same time.
I am using:
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
LIGHT0 have my own parameters.
My Object is fully lighted even if i dont enable LIGHT0!
I am looking for salvation.Please help!
p.s. I hope i can find the answer today.

dvm
11-08-2004, 04:36 AM
I could be way wrong here, but I don't think you can do that. I think lighting does not affect textures. You probably need to apply a second texture that will act as a "light map".

Nico_dup1
11-08-2004, 06:16 AM
Try
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
(but this should be set as default...).
This call controls how texture color and vertex color (lighting is evaluated per vertex and stored as color, which is then interpolated across the primitive) are blended.

iznogoud
11-08-2004, 07:43 AM
Light does affect textures.

I think the problem has to do with normal vectors.
You are probably not specifying any normal vectors
for the vertices. Typically, you give the texel
coordinates (TexCoord), then the normal vector
coordinates, then the vertex coordinates.

Also, you will need to:
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
at initialization.