Lighting&Texture Mapping

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.

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”.

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.

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.