   Move camera in 2D
  Is there any command to move the camera for a simple OpenGL top down 2D game? Think of something like GTA sort of movement. I tried various commands but they were all for 3D games and didn't do what I wanted.   
Quote:Original post by Random89Is there any command to move the camera for a simple OpenGL top down 2D game? Think of something like GTA sort of movement. I tried various commands but they were all for 3D games and didn't do what I wanted.Generally speaking, the techniques used to set up a camera for a 2-d game when using a graphics API such as OpenGL or Direct3D will be the same as in 3-d, only with (perhaps) additional constraints placed on the position and orientation of the camera object.For 'real' 2-d games (i.e. not just a 3-d game played primarily from a top-down perspective), it's fairly common to use an orthographic rather than perspective projection. Otherwise though, the concepts are basically the same irrespective of dimension.Is there a particular aspect of it you're having trouble with?   ;  Mainly just that they seemed a bit more than I needed, like I have a reshape class in there with gluOrtho2D(-50,60,-70,50); in there. I was hoping for something simple like putting gluOrtho2D in the Display class with variables but that didn't work.   ;  glTranslate*() is all you will ever need for simple camera movement in 2D. Just translate the whole scene, in two dimensions only, and always in the other direction from where you want to move the camera.   ;Quote:Original post by lightbringerglTranslate*() is all you will ever need for simple camera movement in 2D. Just translate the whole scene, in two dimensions only, and always in the other direction from where you want to move the camera.How would I use it to translate the entire scene? At the moment I have just been using it to move individual objects?   ;  Just call it right after you reset the ModelView matrix. OpenGL has no real concept of a camera, it's really just an inverse rotation/translation. Conceptually, you could think of it as drawing the scene based on a different origin.glMatrixMode(GL_MODELVIEW);glLoadIdentity();glTranslate() // your inverse camera movement herefor each object:glPushMatrix();// translate (if needed) and render an objectglPopMatrix();