I would use real matrices instead of playing around with OpenGL's functions to modify the current matrix. It makes code much more cleaner and helps you later with newer OpenGL versions where you don't have those functions.
I would set the camera like this:
mat4 camera_transform = translate(snake.position) * rotate_x(angle) * translate(0, 0, distance);
Now the camera should be looking at the snake's position with the specified angle and distance.
Take the inverse of it to get the view matrix:
mat4 view_matrix = inverse(camera_transform);
And rendering could be done like this then:
// Load projection matrix glMatrixMode(GL_PROJECTION); glLoadMatrixf(projection_matrix); // Load view matrix glMatrixMode(GL_MODELVIEW); glLoadMatrixf(view_matrix); // Render an apple glPushMatrix(); glMultMatrixf(apple.transform); render(apple); glPopMatrix();
Hope this helps.