how to use light when with texture on the surface

when the object is render with color, i used light, the light can enhance the reality of teh object, but when the texture is mapped on the surface, I also want to use light to enhance the reality of the object. but it does not function .
the code is as following
glNormal();
glTexCoord2f();
glVertex3f();
can anyone give me some tips about it
many thanks

I suppose your texture is not modulated by the lit material?
Set your texture enviroment to
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
(which is the default, so you probably have set it to GL_DECAL somewhere?)

If you want to get better specular highlights on textures, look into the GL_EXT_separate_specular_color extension.

[This message has been edited by Relic (edited 01-10-2002).]

Hi

when you setup your texture you should set up the correct texture environment:

glTexEnvi(GL_TEX_ENV_MODE,GL_MODULATE);

Bye
ScottManDeath

don’t forget some materials to enhance the reality

JD

Hi!!

If you want to get better specular highlights on textures, look into the GL_EXT_separate_specular_color extension.

I’ve read in an NVIDIA paper that cube-mapping can be also used to produce specular effects. Does it have better results? Could anybody give me some advise about that?

Thanks,
-nemesis-

Cube mapping requires an extra texture unit and some memory bandwidth. Separate specular color doesn’t.

Sure, you can do some nice specular highlights effects with a cube map, but if you can’t afford an extra texture unit, then you have problems.

If separate specular color is enough, then there’s no reason why you should use a cube map.