GL_QUADS Question

Can some one help me figure out why this GL_QUAD is not centering in my program:

#include <gl/glut.h>

void quad();
void init();
void display();

void quad() {
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 0.0 ); glVertex3f( -1.0, 1.0, -1.0 );
glTexCoord2f( 0.0, 1.0 ); glVertex3f( 1.0, 1.0, -1.0 );
glTexCoord2f( 1.0, 1.0 ); glVertex3f( 1.0, -1.0, -1.0 );
glTexCoord2f( 0.0, 1.0 ); glVertex3f( -1.0, -1.0, -1.0 );
glEnd();
}

void keyboard( unsigned char key, int x, int y ) {
switch( key ) {
case 27:
exit( 0 );
break;
default:
break;
}
}

void init() {
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glEnable( GL_DEPTH_TEST );
glShadeModel( GL_SMOOTH );
}

void display() {
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
quad();
glFlush();
}

void reshape( int h, int w ) {
float ratio = 1.0* w / h;

glMatrixMode( GL_PROJECTION );
glLoadIdentity();

glViewport( 0, 0, w, h );

gluPerspective( 25, ratio, 1, 1000 );

glMatrixMode( GL_MODELVIEW );
glLoadIdentity();

gluLookAt( 0.0,0.0,5.0, 
	      0.0,0.0,-1.0,
		  0.0f,1.0f,0.0f );
glutSwapBuffers();

}

int main( int argc, char** argv ) {
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH );
glutEnterGameMode();
init();
glutDisplayFunc( display );
glutReshapeFunc( reshape );
glutKeyboardFunc( keyboard );
glutMainLoop();
return 0;
}

I just figured it out:

#include <gl/glut.h>
#include <gl/glu.h>
#include <gl/gl.h>

void reshape( int w, int h ) {
if( h == 0 )
h = 1;

float ratio = 1.0* w / h;

glMatrixMode( GL_PROJECTION );
glLoadIdentity();

glViewport( 0, 0, w, h );

gluPerspective( 25, ratio, 1, 1000 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
gluLookAt( 0.0, 0.0, 5.0, 0.0, 0.0, -1.0, 0.0f, 1.0f, 0.0f );

}

void display( void ) {
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();

glBegin( GL_QUADS );
	glTexCoord2f( 0.0, 0.0 ); glVertex3f( -1.0, 1.0, -1.0 );
	glTexCoord2f( 0.0, 1.0 ); glVertex3f( 1.0, 1.0, -1.0 );
	glTexCoord2f( 1.0, 1.0 ); glVertex3f( 1.0, -1.0, -1.0 );
	glTexCoord2f( 0.0, 1.0 ); glVertex3f( -1.0, -1.0, -1.0 );
glEnd();

glPopMatrix();

glutSwapBuffers();

}

void keyboard( unsigned char key, int x, int y ) {
switch ( key ) {
case 27: // On ‘Esc’
exit( 0 ); // Quit
break;
}
}

void main( int argc, char **argv ) {
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA );
glutEnterGameMode();
glutDisplayFunc( display );
glutIdleFunc( display );
glutReshapeFunc( reshape );
glutKeyboardFunc( keyboard );

glutMainLoop();

}