   gluLookAt()
  I don't really understand the camera in OpenGL. I'm working on a 2D game using OpenGL, and I keep messing the camera up. What do the parameters of gluLookAt mean? I can't seem to figure them out. My flat grid keeps turning into a wierd little trapezoid whenever I change the parameters.   
  You have an eye point (where the eye is), a target (where the eye is looking) and an "up" vector (which need not actually be up). These are used, in a manner I will not get into since its not particularly important to you for a 2D game, to generate the viewing matrix.However, I'm guessing the problem is not with the glLookAt() call so much as the fact that you may be calling gluPerspective() to generate the projection matrix, which you probably don't want to do for a 2D game (use glOrtho instead).It's also possible you are supplying bogus values to glLookAt(). The eye position and target should be points, not vectors. The up vector should be a vector and should not be parallel to the vector formed by (position - target).   ;  How are you doing your 2D? With the glOrtho projection? or by zero'ing out some axis of all your geometry on a perspective matrix?edit: Put much better by jpetrie   ;  The first 3 parameters mean the position of the camera, second 3 params mean the point the camera is looking at, and the last 3 parameters mean the up vector (usually 0,1,0).The grid problem could be a result of setting incorrect projection matrix. For 2D games you should use glOrtho() (or gluOrtho2D()) rather than glFrustum() (or gluPerspective()).   ;  I am indeed using gluPerspective (mostly because I didn't know there was another way...). My call to it looks like this:gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);What would an equivalent call to glOrtho look like? I'm trying to do it myself, but I'd like to know what it should look like to see if I got it right.   ;  Use gluOrtho2D(0,width,height,0) or gluOrtho2D(0,width,0,height). First one makes top-left corner the point of reference, the second the bottm-left. Also note that gluOrtho2D() sets near and far planes to 1.   ;  I am now using gluOrtho2D, but I'm still not doing too well with gluLookAt. I'm not even sure where my tiles are being drawn now - I don't see them anywhere. Here's my drawing code.int DrawGLScene(GLvoid)// Here's Where We Do All The Drawing{glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear Screen And Depth BufferglLoadIdentity();draw_tiles();return TRUE;// Everything Went OK}int draw_tiles (GLvoid){//int tile;for (int y = 0; y < MAP_SIZEY; y++){for (int x = 0; x < MAP_SIZEX; x++){//tile = map[y][x];//glBindTexture (GL_TEXTURE_2D, textures[tile]);glBegin(GL_QUADS);glTexCoord2f(0.0f, 0.0f); glVertex3f(float(x), float(y), 0.0f);glTexCoord2f(1.0f, 0.0f); glVertex3f(float(x + 1), float(y), 0.0f);glTexCoord2f(1.0f, 1.0f); glVertex3f(float(x + 1), float(y + 1), 0.0f);glTexCoord2f(0.0f, 1.0f); glVertex3f(float(x), float(y + 1), 0.0f);glEnd();}}This is my drawing code. Due to me commenting out my previos tile code, it just draws a big white square, but I should still be able to see my big white square, and I can't. I've tried numerous combinations of parameters passed to gluLookAt, and it doesn't seem to be shown anywhere.   ;  Try to use glOrtho(0,width,height,0,-1,1).Edit:And use bigger tiles. In ortho mode 1 means 1 pixel.   ;  So you're saying that I'm drawing 1x1 pixel tiles? That makes sense... I've been annoyed with gluPerspective's subjective distances for awhile now.I made my tiles 32x32, and now I can see them. I'll play around with the camera until I've got my grid centered in my window. If I have any more questions, I'll ask. Thanks a bunch for the help. glOrtho is exactly what I needed.   ;Quote:In ortho mode 1 means 1 pixel.In ortho mode given by the examples above, 1 means 1 pixel.A minor, but quite important distinction. The problem the original poster is now having stems primarily from a lack of understanding of the 3D graphics pipeline and how his coordinates are being transformed by the pipeline's matrices and how to compensate for changes effected by one thing when another is changed.Even though the game in question is only 2D, OpenGL is a 3D API, after all, and none of the underlying math changes when using OpenGL for 2D rendering.For excellent relevant reading I recommend:"The Geometry Toolbox""Essential Mathematics for Games and Interactive Applications: A Programmers Guide""Fundamentals of Computer Graphics"