Fezziwig
03-18-2012, 07:40 AM
I have always used Ortho projection for my OpenGL programs. But half-way through my current project I have realised that I should instead be using Perspective(Frustrum) projection.
My current reshape function is as follows:
void Reshape(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, WIN_WIDTH, WIN_HEIGHT);
glOrtho(0, WIN_WIDTH, WIN_HEIGHT, 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
I tried swapping the word Ortho to Frustum and a few other ways but none work.
What do I need to do to change it to Perspective projection. Is it just a matter of chopping and changing a few lines or do I have to change the way I draw object?
Thanks,
Rowan.
My current reshape function is as follows:
void Reshape(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, WIN_WIDTH, WIN_HEIGHT);
glOrtho(0, WIN_WIDTH, WIN_HEIGHT, 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
I tried swapping the word Ortho to Frustum and a few other ways but none work.
What do I need to do to change it to Perspective projection. Is it just a matter of chopping and changing a few lines or do I have to change the way I draw object?
Thanks,
Rowan.