PDA

View Full Version : Simple Question



franchela
04-10-2009, 08:27 AM
Hi im new to opengl and i followed a tutorial to make a cube rotate with the mouse. The thing is that i added a point light and i wanted to rotate the light but in the inverse direction of the cube so that it is always lighting the front face. I rotate the cube with this:

glRotatef( g_fRot[0], 1.0f, 0.0f, 0.0f );
glRotatef( g_fRot[1], 0.0f, 1.0f, 0.0f );
glRotatef( g_fRot[2], 0.0f, 0.0f, 1.0f );

And i have my light position with a vector g_fLight[]

I really dont know how to do it :sorrow:

todayman
04-10-2009, 11:56 AM
If you set the position of the light at the beginning when you initialize everything, it should stay put.