Hiya, I’ve got a problem translating the camera with relation to my scene. My code looks like this (its very simple - I’m just starting).
int DrawGLScene(GLvoid)
{
/* Movement Variables */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear screen in color selected in InitGL() function
glLoadIdentity(); // Resets Co-Ordinate system.
//glDisable(GL_DEPTH_TEST); // Disable Depth Testing
//glEnable(GL_BLEND); // Then Blend Space into backround
glBindTexture(GL_TEXTURE_2D, texture[1]);
DrawSpace(); // Draw the Space Texture
glTranslatef(2.0f,2.0f,0.0f);
//glEnable(GL_DEPTH_TEST); // Disable Depth Testing
//glDisable(GL_BLEND); // Disable Blending
glMatrixMode(GL_MODELVIEW); // Switch to MODELVIEW MATRIX
// glTranslatef(0.0f ,0.0f ,zstart); // Translate View
// CameraView(x, y, z, roll, pitch, heading);
glPushMatrix(); // Store Current Position
glBindTexture(GL_TEXTURE_2D, texture[0]); // Select Texture[0]
glTranslatef(0.0f, 0.0f,-5.0f); // Translate 5 units into the screen
DrawSphere(1.0f, 32, 32); // Draw Sphere
glPopMatrix(); // Restore Position to 0,0,0
glPushMatrix(); // Store Current Position
glTranslatef(-5.0f, 0.0f,-5.0f); // Translate 5 units left and 5 units into the screen
glBindTexture(GL_TEXTURE_2D, texture[0]); // Select Texture[0]
DrawSphere(3.0f, 32, 32); // Draw Sphere
glPopMatrix(); // Restore Position to 0,0,0
glPushMatrix(); // Store Current Position
glTranslatef( 5.0f, 0.0f,-5.0f); // Translate 5 units right and 5 units into the screen
glBindTexture(GL_TEXTURE_2D, texture[0]); // Select Texture[0]
DrawSphere(3.0f, 100, 100); // Draw Sphere
glPopMatrix(); // Restore Position to 0,0,0
glPushMatrix();
return TRUE;
}
Basically, all it does is setup start at 0,0,0 , then draw three spheres translated 5 units deep into the screen. Problem is, if I try and change the paramaters in the first glTranslatef() statement, only the central sphere moves, why does it not translate the entire scene? I’m sure I’m missing something fairly fundemental here, any help, greatly appericated.
Thanks