PDA

View Full Version : Lightening problems



01-18-2001, 10:11 AM
I have some problems with GL lightening.
I have a 3D scene exported from blender with
- normals per vertex
- color per vertex
- texture uv per face

*) material properties ok.
*) light source is ok (position + properties)

When i render with
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
glEnable(GL_COLOR_MATERIAL);

==> No lighting.
If i don't use TEXTUREs, i have light ok.
What is happening ??

2) I use a glMultMatrix in my rendering code is it ok for lightning ??

coco
01-18-2001, 10:41 AM
At which point are you defining the light's position? The usual way to do it is after setting the world matrix in the modelview matrix (for example, after gluLookAt).
Also, if you enable GL_COLOR_MATERIAL, you have to use glColor to define material properties, not glMaterial.

01-22-2001, 07:15 AM
Thanks i'll try i after my exams...

j
01-22-2001, 07:44 AM
If lighting works without textures and doesn't work with, you probably have your texture environment set to GL_REPLACE or GL_DECAL. Set it to GL_MODULATE and the lighting should show up.

j