I’m trying to work out the code you need to resize the window properly for vertical aspect ratios, but can’t get it working.
The normal code is:
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
Which works fine, as long as your window is either square or has some sort of horizontal-biased aspect ratio (e.g. 640x480).
But as soon as you adjust the window to have a vertical aspect ratio (480x640), it clips the sides of whatever object I’m viewing instead of keeping it all centred nicely on the screen.
Can anyone help me with this? I know it’s stupid, but I can’t work it out. The aspect ratio should still be worked out the same either way, but it only keeps my object centred when viewing with a horizontal window!
Any help much appreciated!!
Kenny