glOrtho

multiply the current matrix with an orthographic matrix

Signature

glOrtho( GLdouble ( left ) , GLdouble ( right ) , GLdouble ( bottom ) , GLdouble ( top ) , GLdouble ( nearVal ) , GLdouble ( farVal ) )-> void
glOrtho( left , right , bottom , top , zNear , zFar )

Parameters

VariablesDescription
left, right
Specify the coordinates for the left and right vertical clipping planes.
bottom, top
Specify the coordinates for the bottom and top horizontal clipping planes.
nearVal, farVal
Specify the distances to the nearer and farther depth clipping planes. These values are negative if the plane is to be behind the viewer.

Description

glOrtho describes a transformation that produces a parallel projection. The current matrix (see glMatrixMode ) is multiplied by this matrix and the result replaces the current matrix, as if glMultMatrix were called with the following matrix as its argument:
2 right - left 0 0 t x 0 2 top - bottom 0 t y 0 0 -2 farVal - nearVal t z 0 0 0 1
where
t x = - right + left right - left
t y = - top + bottom top - bottom
t z = - farVal + nearVal farVal - nearVal
Typically, the matrix mode is GL_PROJECTION , and left bottom - nearVal and right top - nearVal 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). - farVal specifies the location of the far clipping plane. Both nearVal and farVal can be either positive or negative.
Use glPushMatrix and glPopMatrix to save and restore the current matrix stack.

Errors

GL_INVALID_VALUE is generated if left = right , or bottom = top , or near = far .
GL_INVALID_OPERATION is generated if glOrtho is executed between the execution of glBegin and the corresponding execution of glEnd .

Associated Gets

glGet with argument GL_MATRIX_MODE
glGet with argument GL_COLOR_MATRIX
glGet with argument GL_MODELVIEW_MATRIX
glGet with argument GL_PROJECTION_MATRIX
glGet with argument GL_TEXTURE_MATRIX

See Also

Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glOrtho
OpenGLContext OpenGLContext/framecounter.py Lines: 63
OpenGLContext tests/glhistogram.py Lines: 56
OpenGLContext tests/gldrawpixelssynth.py Lines: 50
OpenGLContext tests/glutbitmapcharacter.py Lines: 18
OpenGLContext tests/gldrawpixels.py Lines: 70
OpenGL-Demo PyOpenGL-Demo/da/dots.py Lines: 90
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/arraytest.py Lines: 62
OpenGL-Demo PyOpenGL-Demo/redbook/hello.py Lines: 86
OpenGL-Demo PyOpenGL-Demo/redbook/scene.py Lines: 114, 117
OpenGL-Demo PyOpenGL-Demo/redbook/drawf.py Lines: 93
OpenGL-Demo PyOpenGL-Demo/redbook/fog.py Lines: 119, 121
OpenGL-Demo PyOpenGL-Demo/redbook/double.py Lines: 90
OpenGL-Demo PyOpenGL-Demo/redbook/teapots.py Lines: 187, 189
OpenGL-Demo PyOpenGL-Demo/tom/Line.py Lines: 9
OpenGL-Demo PyOpenGL-Demo/tom/poly.py Lines: 40
OpenGL-Demo PyOpenGL-Demo/tom/arraytest.py Lines: 28
{Artistic License} PymmLib pymmlib/applications/glutviewer.py Lines: 173
{Artistic License} PymmLib pymmlib/mmLib/OpenGLDriver.py Lines: 153
{LGPL} PyUI2 renderers/openglBase.py Lines: 310
{LGPL} PyUI2 renderers/openglPygame.py Lines: 187
{LGPL} PyUI2 system/openglgraphics.py Lines: 188
{LGPL} Pyggel pyggel/view.py Lines: 283
{LGPL} pygl2d pygl2d/display.py Lines: 60
{GPL} Scocca scocca/graphics/opengl/projections.py Lines: 33
Visvis core/cameras.py Lines: 75
{GPL3} OpenGL-Programmable 05-shader.py Lines: 223
{GPL3} OpenGL-Programmable 07-attrib.py Lines: 242
{GPL3} OpenGL-Programmable 03-array.py Lines: 138
{GPL3} OpenGL-Programmable 06-perpixel.py Lines: 231
{GPL3} OpenGL-Programmable 02-displaylist.py Lines: 136
{GPL3} OpenGL-Programmable 04-vbo.py Lines: 157
{GPL3} OpenGL-Programmable 01-direct.py Lines: 127
{GPL3} OpenGL-Programmable 08-pbo.py Lines: 264

MathML Rendering

Powered by MathJax