Vertical perspective corrections

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:


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!!


I just tested this code, and it seems to work okay, although far from mathematically accurate or fast. :slight_smile:

  if (aspect<1.0)

OK, thanks for the reply, I’ll give that a try! :slight_smile: