newbie light question

Hi,
I drawn my scene with a grid (white lines) and a square with a texture; I’m trying to change light position and I can see the difference only on the grid; why this? why I can’t change difference light in my textured sqaure; thanks


const float spec[4]={.4f,.4f,.4f,1};
const float shin = 1;
glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR ,spec);
glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS ,shin);

GLfloat light_position[4] = {0,4,2,0};
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_DIFFUSE, white_light);
glLightfv(GL_LIGHT0, GL_AMBIENT,light_ambient);
glLightfv(GL_LIGHT0, GL_AMBIENT,light_diffuse);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
............................

If u want to change light position u must update your light position every frame. for example:

void Draw()
{
glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);

… // Some Draw code
}

this is ok; in fact I can see effect of light changing, but only on white grid! I don’t see effect on sqaure textured.Why this?

What texture function you use on the textured grid? If it is GL_REPLACE, you will need to use GL_MODULATE instead.

It’s seems don’t change; change luminacne of some objects drawn with glVertex() and glColor but not texture…

:rolleyes:

maybe I didin’t to be clear; The grid are many lines white; the textures are on a square; then there’s an arrow ( drawn with gevertex,glcolor…). I can see effect of change light position on the grid, on the arrow, but not on the texture ( i can change light pos very much, but the square textures appear in the same way). Is it normal?
Thanks

post a Screenshot

here is a site that can host
http://imageshack.us/

and BTW do you have your normals loaded?