Click to See Complete Forum and Search --> : [OpenGL] Lighting with Textures


GordonFreeman
June 10th, 2006, 04:35 PM
I tried drawing some triangles with some material properties,such as shininess and ambient/diffuse reflectance.

Then,i enabled GL_LIGHT0 and tried to set GL_SPECULAR parameter with different colors,and the triangles reflected the light as expected...

At this point,i mapped a texture on those triangles,leaving unchanged the material parameters,and they always look like they are fully enlightened with a light color of (1,1,1,1) (full white) , no matter how i modify the light and material parameters,and even with a total dark light (0,0,0,0) or (0,0,0,1).

It seems that textured triangles are not affected by lighting operations,is it so??
Is it the same with Direct3D ?

JohnyDog
June 11th, 2006, 09:40 AM
The lighting should work the same, texture or not. Can you post the code ?

GordonFreeman
June 12th, 2006, 11:50 AM
The lighting should work the same, texture or not. Can you post the code ?

Ok,i solved,i made this call


glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);


and then i painted the triangle with a white color (1,1,1,1) , which will be enlightened by the light,therefore it will assume its color , and that color will modulate the texture applied to the triangle, obtaining the effect of enlightening the texture
is it right?
it seems to me that the result on screen is correct