Members - Reputation: 122
Posted 06 October 2001 - 06:06 PM
(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
left and right are x-axis coordinate bounds
bottom and top are the y-axis coordinate bounds
near and far are the z-axis coordinate bounds
gluOrtho2D() is just a special case of glOrtho() which automatically sets near and far (z-axis coordinate bounds) to be between -1.0 and 1.0.
These functions basically allow you to set up your own coordinate system for whatever drawing you want to do. Instead of drawing in actual screen coordinates, you would be drawing in your coordinate system, as you specified.
Say I wanted to draw a large square centered in the middle of a screen with the coordinate system specified as
glOrtho(-30.0, 30.0, -30.0, 30.0, 30.0, -30.0);
Here''s how I''d do it
glVertex3f(-25.0, -25.0, 0.0); //lower-left, z-axis at origin
glVertex3f(25.0, -25.0, 0.0); //lower-right
glVertex3f(25.0, 25.0, 0.0); //upper-right
glVertex3f(-25.0, 25.0, 0.0); //upper-left
This would leave a 5 unit space around the square, because the bounds of my coordinate system extended between -30 and 30 for every axis.
Hope this helps,