Clipping of vertices in drawing wireframe cube to center of screen

I have what I’m sure is a simple question about clipping when trying to draw to screen. I am trying to draw a cube in the center of the screen. I know that I have the correct vertices being fed into the glVertex3dv command.

My picture looks like something like this: Here

As you can see, some of these vertices are not showing up correctly. Also, I’d like to know how I can always have the cube appear in the center of the screen. So I can zoom out/in etc.

display(void){

   glClear(GL_COLOR_BUFFER_BIT);
   glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();

  gluLookAt(0.0, 0.0, 1.0, centroid_x, centroid_y, centroid_z, 0.0, 1.0, 0.0);

  /*Insert vertex coordinates using glVertex3dv*/

  glutSwapBuffers();

}

Like I said, I’m looking for a way to use the gluLookAt command to always have the object front and center in the window and how to stop clipping from happening. Thanks for any help you all may provide!

[QUOTE=Heisenberg;1291151]I have what I’m sure is a simple question about clipping when trying to draw to screen. I am trying to draw a cube in the center of the screen. I know that I have the correct vertices being fed into the glVertex3dv command.

My picture looks like something like this: Here
[/QUOTE]
That looks part of the cube is being clipped away by the near plane or far plane. How are you setting up the projection matrix? If you are leaving it at the default (an identity matrix), the near and far planes will be at -1 and 1 respectively.

The object-space origin will be at the centre of the screen unless you explicitly move it with e.g. glTranslate(). If you want the viewpoint to be specified relative to the object, the simplest solution is to use a combination of glRotate() and glTranslate() rather than gluLookAt().