Hello,
I have been reading the blue book and I have a problem. I can’t reproduce the example of moving the viewpoint and with it moving a light.
This is my projection transformation:
glViewport(0,0,canvasWidth,canvasHeight);//set the current viewport
glMatrixMode(GL_PROJECTION);//Reset the projection matrix
glLoadIdentity();
gluPerspective(45.0f,(GLfloat)canvasWidth/canvasHeight,0.1f,100.0f);
glTranslatef(pX,pY,pZ);
glRotatef(pYR,1.0f,0.0f,0.0f);
glRotatef(pXR,0.0f,1.0f,0.0f);
glLightfv(GL_LIGHT1,GL_POSITION,lightPosition);
lightPosition is set at 0.0,0.0,0.0,1.0 so that it is at the origin and considering that the viewpoint moves with the translations and rotations and so would the light.
The problem is that this does not happen. The light seems to be stationary. Whenever I translate the viewpoint and look at my objects from other angles/views the light seems stationary and it definetely does not originate from the viewpoint(eye of the user).
Any tips on how to do it? I must have completely misunderstood something. Thanks in advance