PDA

View Full Version : More on how to maintain perspective



11-03-2000, 06:16 AM
Hi All,

I posted a question about maintaining the correct perspective when the window is resized. Although I received two responses I am still not sure how to do this based on how my code is implemented. Here is my resize code:

glViewport(0, 0, (GLsizei) Display->Width, (GLsizei) Display->Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(TempWX1, TempWX2, TempWY1,TempWY2,TempWZ1,TempWZ2);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
***
I read in a model and then set the TempWX's based on the size of the model. I also use the TempWX's for zooming. I am not sure how to modify my code so that whether the window is square or rectangular...etc the model always looks correct. With the current code if I make the window wider than the height the model gets fat or skinny...etc. Also, since the model can be zoomed or panned I was
hoping that the procedure to maintain the perspective doesn't mean that the model will be inside a square within the display area so that if the model is panned it will only pan over so far and then it will get chopped off even though technically there is still more display area available but it can not be used by OpenGL.

I hope I have worded this correctly.

Thanks in advance,

Joe

11-04-2000, 08:17 AM
Thanks anyways but I figured out that I just
need to take the ratio of the window and scale my glOrtho to the same ration. Works like a charm.

11-05-2000, 09:23 AM
then del ur post!