OpenGL Functions
We use the following function when our world is two dimensional and drawn in the x-y coordinate plane.
void gluOrtho2D(GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top)
The parameters to the function establish the projection window and,
in turn, the clipping boundaries. Any portion of the geometry that
is outside of these boundaries will not appear in our display.
By default, the area within the projection window is displayed within the entire device window (canvas). As seen in this tutorial, we can
set a portion of the device window, called the viewport, to display the contents of the projection window. We do this with the following function.
void glViewport(GLint x,
GLint y
GLsizei width,
GLsizei height)
The first two parameters set the lower-left corner of the viewport while the last two set its width and height. We give the parameters as pixel values and generally we use percentages the width and height of the device window.