PDA

View Full Version : LOCAL_VIEWER doesn't work ! Help me !



gaby
11-20-2000, 01:17 PM
My method to lit my scene is to setup the matrix to null and set the position of the light in LOCAL_VIEWER...

I use the instruction :

glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, true);

While y move my light position, the position I set (remeber : with a null matrix, I tell glLoadEntity before) is taken as the direction vector of an infinit light (when the position is set to [0,0,0,], the light doesn't work, so, it's really the light direction).

After that, y setup the matrix to set each object transform taken for rendering.

What is the problem ? Is it posible that my workstation doesn't support per-vertex vector computation ?

Y use a SGI with the Cobalt chipset.

Thanks !

Gabriel RABHI / Z-OXYDE / France

gaby
11-21-2000, 04:27 AM
Y have understand my error :
when specifying the position, we have to set w value to 1, if not the light is setup as distant light!

Here the code :

GLfloat f_pos[4];

f_pos[0] = t_pos.x;
f_pos[1] = t_pos.y;
f_pos[2] = t_pos.z;
f_pos[3] = 1.000;<- !

glLightfv(GL_LIGHT0, GL_POSITION,f_pos);

Gabriel RABHI / Z-OXYDE / France