Texture and light at the same time

Started by
4 comments, last by AIRmichael 21 years, 10 months ago
Hey, I cant use light and have a texture at the same time. Does any 1 know how to fix this? I enabled the lighting. And it only works when there is no texture on it. I am just useing standard lighting atm. Useing glLightAmbient etc. Michael L.
Advertisement
you need to set the tex-coords using glTexCoord2f, and the normal using glNormal3f for each vertex so that it would work
use
glBindTexture(GL_TEXTURE_2D,&YourTexture);
glTexEnv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);

This will fix will problem i hope
Z
ooopsss, that should be
glTexEnvf(.....)
Z
I recently discovered a solution to this by accident, in creating my game. For instance, if using spheres have an inner sphere emitting light and have a second transparent sphere enclosing the emitting sphere, texture mapped. The texture map of the transparent sphere also inherets the tranparency.

Regards,
Mathematix.
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);

works!!! thanks alot!!!!))

This topic is closed to new replies.

Advertisement