PDA

View Full Version : Coordinate System: how to change?



lordpippo
10-04-2003, 05:42 AM
Hi all!

The default OpenGL coordinate system, in 2D, is (-1, 1) in the upper-left
corner of the windows and (1, -1) in the bottom-right corner. It is
possibile to change this system? In particular, I need to have a coordinate
system in which (0, 0) is the upper-left corner and (640, 480) the
bottom-right corner.

Thanks in advance,
--
Marco Minerva, marco.minerva@libero.it http://www.marcominerva.com

yaro_dup1
10-04-2003, 06:43 AM
Read about projection modes and glOrtho. You have to understand how they works and then you'll manage the problem.

10-04-2003, 04:16 PM
And to handle the upside-down aspect of things, take a look at glScale. Scale your image by -1 in the direction you want to flip, then translate the coordinate system back to where you want it.

While fiddling with all these things, it's easy to get directions mixed up. I recommend drawing four lines that lie just inside where you expect the visible area to be - that way you can immediately see whether things are correct or not.