10-11-2005, 06:16 PM
I have a window with some objects in it in orthographic view. Is there a way in my reshape function to ensure that the objects do not get distorted.
can i manipulate my glOrtho(...) values to do this?
orthographic projection defines a set of lines on the XY plane defined by x=left, x=right, y=top and y=bottom. The trick, then, is to work out how you want your viewport with some width/height to map to these lines so the ratio between top-bottom and right-left is the same as the viewport ratio.
So, for examaple, suppose your viewport is twice as wide as its height. Further suppose you choose to set the vertical viewing range to be from y=1 to y=-1; then what horizontal bounds do you put on the orthographic projection? Well, y=1 and y=-1 defines a vertical range of 2, right? So if your viewport is twice as wide then you COULD choose the left bound to be 0 and the right bound to be 4... or any variation thereof (like x=-2 and x=2, or x=-1 and x=3).
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.