Previous: glObjectPtrLabel Table of Contents (GL) Next: glPassThrough

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 , near_val , far_val )

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 tests/gldrawpixelssynth.py Lines: 51
OpenGLContext tests/glhistogram.py Lines: 58
OpenGLContext tests/gldrawpixels.py Lines: 71
OpenGLContext tests/glutbitmapcharacter.py Lines: 20
OpenGLContext OpenGLContext/framecounter.py Lines: 63
OpenGL-Demo PyOpenGL-Demo/redbook/double.py Lines: 92
OpenGL-Demo PyOpenGL-Demo/redbook/fog.py Lines: 120, 122
OpenGL-Demo PyOpenGL-Demo/redbook/teapots.py Lines: 185, 187
OpenGL-Demo PyOpenGL-Demo/redbook/hello.py Lines: 84
OpenGL-Demo PyOpenGL-Demo/redbook/drawf.py Lines: 94
OpenGL-Demo PyOpenGL-Demo/redbook/scene.py Lines: 112, 115
OpenGL-Demo PyOpenGL-Demo/da/dots.py Lines: 90
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/arraytest.py Lines: 66
OpenGL-Demo PyOpenGL-Demo/tom/Line.py Lines: 13
OpenGL-Demo PyOpenGL-Demo/tom/arraytest.py Lines: 30
OpenGL-Demo PyOpenGL-Demo/tom/poly.py Lines: 43
Glinter Widget.py Lines: 56
{Artistic License} PymmLib applications/glutviewer.py Lines: 173
{Artistic License} PymmLib mmLib/OpenGLDriver.py Lines: 146
{LGPL} PyUI pyui/renderers/openglPygame.py Lines: 184
{LGPL} PyUI pyui/renderers/openglBase.py Lines: 310
{LGPL} PyUI2 system/openglgraphics.py Lines: 188
{LGPL} PyUI2 renderers/openglPygame.py Lines: 187
{LGPL} PyUI2 renderers/openglBase.py Lines: 310
{LGPL} Pyggel pyggel/view.py Lines: 283
{LGPL} pygl2d pygl2d/window.py Lines: 72
{GPL} Scocca scocca/graphics/opengl/projections.py Lines: 33
Visvis core/cameras.py Lines: 75

MathML Rendering

Powered by MathJax
Previous: glObjectPtrLabel Table of Contents (GL) Next: glPassThrough