LiGhtninG and textures

I’ve got a free form object and texture puttinG on it. And one liGht source. How can i make my texture to chanGe it pixels liGhtness accordinG to the location of the liGht source.

uh you should fix your g key :slight_smile:
i can only guess what you want to do but you’re probably talking about normal mapping. you will need to write shaders for that. here you can find tutorials on this technique: http://www.ultimategameprogramming.com/

Oh, thank you. :slight_smile:
I will try it right now.

Sorry, i have to do this without shaders.
Maybe i should repeat my question more simple.
I have an object with texture and light source. Light source has no effect on texture. How can i do that?

You need to calculate the normals for each vertex in your model, and then you’ll be able light your object from any angle.

Read this for starters:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=07

Also, you need to make sure that your texturing environment is set up as GL_MODULATE.

I think the default is GL_DECAL which does a straight replace of the fragment color with the texture sample. This will obliterate any lighting calculations since lighting is done first.