I am trying to get a perspective view to work with Vincent.
I have set it up as follows :
glViewport(0, 0, width, height);
ugluPerspectivef(45.0f, (float)(width / height), 0.1f, 20.0f);
My display code is as follows. I have enabled depth testing and have cleared the depth buffer and set the depth function to GL_LEQUAL.
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
glTranslatef(-0.25f, 0.0f, -1.0f);
This renders a red square and a green square in front of the red square.
First of all, shouldn’t the translation of -1.0f in the z axis move the green square behind the red one, not the other way around.
Second of all, the squares are the same size. Shouldn’t they be different sizes considering that they are not in the same place in the z axis.
Any ideas of what could be wrong.