glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslate(-5, -10, 5);
glRotate(-90, 0, 0, 1);
And then do all your drawing. That should do the trick I might have the translate and rotate backwards though...
Jonathan
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslate(-5, -10, 5);
glRotate(-90, 0, 0, 1);
And then do all your drawing. That should do the trick I might have the translate and rotate backwards though...
Jonathan
void display() // at this point GL_MATRIXMODE is set
{
...//Clear buffers...
glPushMatrix();
glTranslatef(-playerXpos,-playerYpos,-playerZpos);
glRotatef(LookUpDownAngle,-1,0,0);
glRotatef(LookLeftRightAngle,0,0,-1);
// Draw all objects in cameraview
glPopMatrix();
...
}
player_pos is the actual position of your cam in world coordinates. LookUpDownAngle and LookLeftRight is the direction your cam is looking at. When you know how to use a matrix you can use the OpenGL function:
void glMultMatrixd(
const GLdouble *m
);
m is the 4x4 Matrix (double in this case)
void display() // at this point GL_MATRIXMODE is set
{
...
//Clear buffers...
glPushMatrix();
glRotatef(LookUpDownAngle,-1,0,0);
glRotatef(LookLeftRightAngle,0,0,-1); glTranslatef(-playerXpos,-playerYpos,-playerZpos);
// Draw all objects in cameraview
glPopMatrix();
...
}