Coordinate System: how to change?

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

Read about projection modes and glOrtho. You have to understand how they works and then you’ll manage the problem.

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.