Here is my setup code for the projection, viewports, etc.:
glViewport(0, 0, 640, 480);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, 640/480, 0.1, 1000);
glMatrixMode(GL_MODELVIEW);
And here is my drawing code:
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 5, 0, 0, 0, 0, 1, 0);
glPushMatrix();
glBegin(GL_QUADS);
glVertex3i(-5, -5, -20);
glVertex3i(5, -5, -20);
glVertex3i(5, 5, -20);
glVertex3i(-5, 5, -20);
glEnd();
glPopMatrix();
Because I have set my aspect ratio to 640/480, I’d think the quad would display as a square. But nope, it is displayed as a rectangle with a 4/3 width to height ratio. What am I missing here?