I’m trying to implement OpenGL’s perspective calculations. I thought this would be a very simple task, and it should be, but for some reason there does not appear to be perspective. Things moved in Z do not appear bigger or smaller. I can’t post every line of code in the project for it is quite long and i don’t know what is causing the problem, so I tried to narrow it down to a few lines that relate to the perspective. If this doesn’t include all the gl calls that are suspects of this problem please tell me and ill bee happy to post other sections of the code.
The code:
flags = SDL_OPENGL | SDL_FULLSCREEN;
GLsizei width = idConfig.resX;
GLsizei height = idConfig.resY;
if (idConfig.resY==0) // Prevent A Divide By Zero By
{
idConfig.resY=1; // Making Height Equal One
}
screen = SDL_SetVideoMode(idConfig.resX, idConfig.resY, 0, flags);
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,(GLdouble)width/(GLdouble)height,1,10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);