gl.Ortho(left, right, bottom, top, zNear, zFar)
gl.Ortho()
describes a transformation that produces a parallel projection. The current matrix
(See gl.MatrixMode for details.) is multiplied by this matrix and the result replaces the
current matrix, as if gl.MultMatrix() were called with the following matrix
as its argument:
A 0 0 tx 0 B 0 ty 0 0 C tz 0 0 0 1 |
where
A = 2 / (right - left) B = 2 / (top - bottom) C = -2 / (far - near) tx = -(right + left) / (right - left) ty = -(top + bottom) / (top - bottom) tz = -(zFar + zNear) / (zFar - zNear) |
Typically, the matrix mode is #GL_PROJECTION
, and (left, bottom, -zNear) and (right, top, -zNear) specify the points on
the near clipping plane that are mapped to the lower left and upper right corners of the window, respectively, assuming
that the eye is located at (0, 0, 0). -zFar specifies the location of the far clipping plane. Both zNear and zFar can
be either positive or negative.
Use gl.PushMatrix() and gl.PopMatrix() to save and restore the current matrix stack.
Please consult an OpenGL reference manual for more information.
#GL_INVALID_VALUE
is generated if left = right, or bottom = top, or zNear = zFar.
#GL_INVALID_OPERATION
is generated if gl.Ortho()
is executed between the execution of gl.Begin() and the corresponding execution of gl.End().
#GL_MATRIX_MODE
gl.Get() with argument #GL_MODELVIEW_MATRIX
gl.Get() with argument #GL_PROJECTION_MATRIX
gl.Get() with argument #GL_TEXTURE_MATRIX