Resize display and keeping aspect ratio....

Under glut how can I enforce that when a window is reshaped that it keep’s the aspect ratio of my scene?

Also is there a way to lock a windows size under glut?

I asked a similar question a couple of months ago. You can’t lock the window size (at least not easily I believe) and I am still having trouble maintaining the aspect ratio.

I’ll be interested to see if you get any better answers…

I did this and it works!!!
With a little more work, I think the aspect also can be managed this way also.

void reshape (int w, int h)
{
if (( w != 500 ) | | ( h != 250 )) The fix size that I want.
{
glutReshapeWindow( 500, 250); Return window to my size.
w = 500; // for processing the rest of my reshape routine.
h = 250;
}
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho(0.0f, (GLfloat) w,(GLfloat) h, 0.0f,-10.0f,10.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
}

Originally posted by endo:
[b]I asked a similar question a couple of months ago. You can’t lock the window size (at least not easily I believe) and I am still having trouble maintaining the aspect ratio.

I’ll be interested to see if you get any better answers…[/b]

[This message has been edited by nexusone (edited 04-04-2002).]