new23D
05-14-2003, 06:06 PM
Hi! i am trying to put in a stationary light source in my scene.i have created the source as follows:
void CTestCubeView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
glViewport(0,0,cx,cy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0,1.0,-1.0,1.0,2,50.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
GLfloat light_position[] = {3.0,10.0,-5.0,0.0};
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
}
but it is still positioned on one side of my object and seems to move along with it while i rotate the object.could anyone advise me if i have not initialised it properly.
Thanks in advance!
void CTestCubeView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
glViewport(0,0,cx,cy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0,1.0,-1.0,1.0,2,50.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
GLfloat light_position[] = {3.0,10.0,-5.0,0.0};
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
}
but it is still positioned on one side of my object and seems to move along with it while i rotate the object.could anyone advise me if i have not initialised it properly.
Thanks in advance!