I have a great confusion, when I have to use the glOrtho function, I do not know which system of coordinates it uses for its parameters, namely: left, right, bottom, up, close, do they are compared to what coordinate system? Would it be possible to have a figure that shows me clearly and unambiguously?
Eye space. If you get a decent OpenGL book, it’ll describe this pretty clearly:
- OpenGL Projection Matrix (Ahn)
[QUOTE=Dark Photon;1288316]Eye space. If you get a decent OpenGL book, it’ll describe this pretty clearly:
- OpenGL Projection Matrix (Ahn)[/QUOTE]
Ok, but near and far in the glOrtho: these values are negative if the plane is to be behind the viewer. Is the viewer the camera or the object ?
Correct. So near/far are actually the negation of eye-space Z axis values.
Is the viewer the camera or the object ?
The camera.
To your original question, the glOrtho parameter values are specified in eye-space. In eye-space, the camera (the viewer) is at the origin looking down the -Z axis with +X right and +Y up.
So as for the glOrtho parameters…:
[ul]
[li]left and right are eye-space X axis values [/li][li]bottom and top are eye-space Y axis values [/li][li]near and far are eye-space Z axis values, but negated! [/li][/ul]
So for instance, glOrtho with a near argument of 1.0 equates to the Z = -1.0 plane in eye-space, which is in front of the eye (the origin).
[QUOTE=Dark Photon;1288322]Correct. So near/far are actually the negation of eye-space Z axis values.
The camera.
To your original question, the glOrtho parameter values are specified in eye-space. In eye-space, the camera (the viewer) is at the origin looking down the -Z axis with +X right and +Y up.
So as for the glOrtho parameters…:
[ul]
[li]left and right are eye-space X axis values [/li][li]bottom and top are eye-space Y axis values [/li][li]near and far are eye-space Z axis values, but negated! [/li][/ul]
So for instance, glOrtho with a near argument of 1.0 equates to the Z = -1.0 plane in eye-space, which is in front of the eye (the origin).[/QUOTE]
Oh, it’s finally clear now. So close values and positive results in GlOrtho are actually negative on z axis.
Thank you, Dark Photon