glOrtho co-ordinates

Hi Everyone,

Bit of a beginner’s question here… I’m having a bit of trouble understanding how co-ordinates are mapped in a glOrtho projection… I’m using the following call to set the coordinates:

glOrtho(0, Xsize, 0, Ysize, 0, Zsize);

…where Xsize, Ysize, and Zsize have all been initialised to 450. The X and Y coordinates seem to behave as expected, but I can’t understand how Z works. As I understood it, 0 should be right at the ‘front’ of the screen, while 450 should be as far away as its possible to get… But clearly this isn’t the case. I’ve placed a sphere at (225.0, 225.0, 0.0) - no problem there. But when I put another one at (225.0, 225.0, 2.0), which should be behind the first one, I can still see the new sphere, even though I have enabled depth testing. There is also some other strange behaviour that suggests that I haven’t understood properly how the Z axis works… Could someone who has a good understanding of this please explain it to me? What I’d like is to have all three axes with values running from 0 to 450, where the positive Z axis runs ‘into’ the screen (i.e. Z=450 is a far away as you can get). Can anyone explain to me how to do this ???

Thanks very much,

Music Technology Group
University of York

I see… Thanks. So, if I set the near and far planes to, say, 1 and 450 respectively then 1 will be closest to the screen and 450 will be as far ‘into’ the screen as possible - is this correct? Sorry to ask such basic questions…! Only, I can’t find any documentation that I understand.