Previous: glPushName Table of Contents (GL) Next: glReadBuffer

glRasterPos

specify the raster position for pixel operations

Deprecation Notice

Note that this function has been marked deprecated in the OpenGL 3.0 specification. You should not be using this function in new code, though it will likely be supported by most implementations via the GL_ARB_compatibility extension. For more information on OpenGL 3.x deprecations, see the deprecations page.

Signature

glRasterPos( )->
glRasterPos( * args )
Choose glRasterPosX based on number of args
glRasterPos2d( GLdouble ( x ) , GLdouble ( y ) )-> void
glRasterPos2d( x , y )
glRasterPos2d( GLdouble(x), GLdouble(y) ) -> None
glRasterPos2dv( const GLdouble * ( v ) )-> void
glRasterPos2dv( v )
glRasterPos2dv( arrays.GLdoubleArray(v) ) -> None
glRasterPos2f( GLfloat ( x ) , GLfloat ( y ) )-> void
glRasterPos2f( x , y )
glRasterPos2f( GLfloat(x), GLfloat(y) ) -> None
glRasterPos2fv( const GLfloat * ( v ) )-> void
glRasterPos2fv( v )
glRasterPos2fv( arrays.GLfloatArray(v) ) -> None
glRasterPos2i( GLint ( x ) , GLint ( y ) )-> void
glRasterPos2i( x , y )
glRasterPos2i( GLint(x), GLint(y) ) -> None
glRasterPos2iv( const GLint * ( v ) )-> void
glRasterPos2iv( v )
glRasterPos2iv( arrays.GLintArray(v) ) -> None
glRasterPos2s( GLshort ( x ) , GLshort ( y ) )-> void
glRasterPos2s( x , y )
glRasterPos2s( GLshort(x), GLshort(y) ) -> None
glRasterPos2sv( const GLshort * ( v ) )-> void
glRasterPos2sv( v )
glRasterPos2sv( arrays.GLshortArray(v) ) -> None
glRasterPos3d( GLdouble ( x ) , GLdouble ( y ) , GLdouble ( z ) )-> void
glRasterPos3d( x , y , z )
glRasterPos3d( GLdouble(x), GLdouble(y), GLdouble(z) ) -> None
glRasterPos3dv( const GLdouble * ( v ) )-> void
glRasterPos3dv( v )
glRasterPos3dv( arrays.GLdoubleArray(v) ) -> None
glRasterPos3f( GLfloat ( x ) , GLfloat ( y ) , GLfloat ( z ) )-> void
glRasterPos3f( x , y , z )
glRasterPos3f( GLfloat(x), GLfloat(y), GLfloat(z) ) -> None
glRasterPos3fv( const GLfloat * ( v ) )-> void
glRasterPos3fv( v )
glRasterPos3fv( arrays.GLfloatArray(v) ) -> None
glRasterPos3i( GLint ( x ) , GLint ( y ) , GLint ( z ) )-> void
glRasterPos3i( x , y , z )
glRasterPos3i( GLint(x), GLint(y), GLint(z) ) -> None
glRasterPos3iv( const GLint * ( v ) )-> void
glRasterPos3iv( v )
glRasterPos3iv( arrays.GLintArray(v) ) -> None
glRasterPos3s( GLshort ( x ) , GLshort ( y ) , GLshort ( z ) )-> void
glRasterPos3s( x , y , z )
glRasterPos3s( GLshort(x), GLshort(y), GLshort(z) ) -> None
glRasterPos3sv( const GLshort * ( v ) )-> void
glRasterPos3sv( v )
glRasterPos3sv( arrays.GLshortArray(v) ) -> None
glRasterPos4d( GLdouble ( x ) , GLdouble ( y ) , GLdouble ( z ) , GLdouble ( w ) )-> void
glRasterPos4d( x , y , z , w )
glRasterPos4d( GLdouble(x), GLdouble(y), GLdouble(z), GLdouble(w) ) -> None
glRasterPos4dv( const GLdouble * ( v ) )-> void
glRasterPos4dv( v )
glRasterPos4dv( arrays.GLdoubleArray(v) ) -> None
glRasterPos4f( GLfloat ( x ) , GLfloat ( y ) , GLfloat ( z ) , GLfloat ( w ) )-> void
glRasterPos4f( x , y , z , w )
glRasterPos4f( GLfloat(x), GLfloat(y), GLfloat(z), GLfloat(w) ) -> None
glRasterPos4fv( const GLfloat * ( v ) )-> void
glRasterPos4fv( v )
glRasterPos4fv( arrays.GLfloatArray(v) ) -> None
glRasterPos4i( GLint ( x ) , GLint ( y ) , GLint ( z ) , GLint ( w ) )-> void
glRasterPos4i( x , y , z , w )
glRasterPos4i( GLint(x), GLint(y), GLint(z), GLint(w) ) -> None
glRasterPos4iv( const GLint * ( v ) )-> void
glRasterPos4iv( v )
glRasterPos4iv( arrays.GLintArray(v) ) -> None
glRasterPos4s( GLshort ( x ) , GLshort ( y ) , GLshort ( z ) , GLshort ( w ) )-> void
glRasterPos4s( x , y , z , w )
glRasterPos4s( GLshort(x), GLshort(y), GLshort(z), GLshort(w) ) -> None
glRasterPos4sv( const GLshort * ( v ) )-> void
glRasterPos4sv( v )
glRasterPos4sv( arrays.GLshortArray(v) ) -> None

Parameters

VariablesDescription
x, y, z, w
Specify the x , y , z , and w object coordinates (if present) for the raster position.

Parameters

v
Specifies a pointer to an array of two, three, or four elements, specifying x , y , z , and w coordinates, respectively.

Description

The GL maintains a 3D position in window coordinates. This position, called the raster position, is used to position pixel and bitmap write operations. It is maintained with subpixel accuracy. See glBitmap , glDrawPixels , and glCopyPixels .
The current raster position consists of three window coordinates ( x , y , z ), a clip coordinate value ( w ), an eye coordinate distance, a valid bit, and associated color data and texture coordinates. The w coordinate is a clip coordinate, because w is not projected to window coordinates. glRasterPos4 specifies object coordinates x , y , z , and w explicitly. glRasterPos3 specifies object coordinate x , y , and z explicitly, while w is implicitly set to 1. glRasterPos2 uses the argument values for x and y while implicitly setting z and w to 0 and 1.
The object coordinates presented by glRasterPos are treated just like those of a glVertex command: They are transformed by the current modelview and projection matrices and passed to the clipping stage. If the vertex is not culled, then it is projected and scaled to window coordinates, which become the new current raster position, and the GL_CURRENT_RASTER_POSITION_VALID flag is set. If the vertex is culled, then the valid bit is cleared and the current raster position and associated color and texture coordinates are undefined.
The current raster position also includes some associated color data and texture coordinates. If lighting is enabled, then GL_CURRENT_RASTER_COLOR (in RGBA mode) or GL_CURRENT_RASTER_INDEX (in color index mode) is set to the color produced by the lighting calculation (see glLight , glLightModel , and glShadeModel ). If lighting is disabled, current color (in RGBA mode, state variable GL_CURRENT_COLOR ) or color index (in color index mode, state variable GL_CURRENT_INDEX ) is used to update the current raster color. GL_CURRENT_RASTER_SECONDARY_COLOR (in RGBA mode) is likewise updated.
Likewise, GL_CURRENT_RASTER_TEXTURE_COORDS is updated as a function of GL_CURRENT_TEXTURE_COORDS , based on the texture matrix and the texture generation functions (see glTexGen ). Finally, the distance from the origin of the eye coordinate system to the vertex as transformed by only the modelview matrix replaces GL_CURRENT_RASTER_DISTANCE .
Initially, the current raster position is (0, 0, 0, 1), the current raster distance is 0, the valid bit is set, the associated RGBA color is (1, 1, 1, 1), the associated color index is 1, and the associated texture coordinates are (0, 0, 0, 1). In RGBA mode, GL_CURRENT_RASTER_INDEX is always 1; in color index mode, the current raster RGBA color always maintains its initial value.

Notes

The raster position is modified by glRasterPos , glBitmap , and glWindowPos .
When the raster position coordinates are invalid, drawing commands that are based on the raster position are ignored (that is, they do not result in changes to GL state).
Calling glDrawElements or glDrawRangeElements may leave the current color or index indeterminate. If glRasterPos is executed while the current color or index is indeterminate, the current raster color or current raster index remains indeterminate.
To set a valid raster position outside the viewport, first set a valid raster position, then call glBitmap with NULL as the bitmap parameter.
When the
ARB_imaging
extension is supported, there are distinct raster texture coordinates for each texture unit. Each texture unit's current raster texture coordinates are updated by glRasterPos .

Errors

GL_INVALID_OPERATION is generated if glRasterPos is executed between the execution of glBegin and the corresponding execution of glEnd .

Associated Gets

glGet with argument GL_CURRENT_RASTER_POSITION
glGet with argument GL_CURRENT_RASTER_POSITION_VALID
glGet with argument GL_CURRENT_RASTER_DISTANCE
glGet with argument GL_CURRENT_RASTER_COLOR
glGet with argument GL_CURRENT_RASTER_SECONDARY_COLOR
glGet with argument GL_CURRENT_RASTER_INDEX
glGet with argument GL_CURRENT_RASTER_TEXTURE_COORDS

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.

glRasterPos
OpenGLContext tests/glutmousewheel.py Lines: 16
OpenGLContext tests/_bitmap_font.py Lines: 52, 66, 81
OpenGLContext tests/glut_font.py Lines: 35
glRasterPos2f
OpenGLContext tests/glprint.py Lines: 113
OpenGLContext tests/getteximage.py Lines: 19, 21
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson13.py Lines: 158
Glinter Widget.py Lines: 87
{LGPL} PyUI pyui/renderers/openglGlut.py Lines: 252
{LGPL} PyUI2 renderers/openglGlut.py Lines: 252
{LGPL} PyUI2 system/openglgraphics.py Lines: 243
{GPL} Scocca scocca/frontend/blender/utils.py Lines: 30
glRasterPos2i
OpenGLContext tests/gldrawpixelssynth.py Lines: 51
OpenGLContext tests/gldrawpixels.py Lines: 71
OpenGLContext tests/glutbitmapcharacter.py Lines: 24, 30
OpenGLContext tests/glhistogram.py Lines: 62, 77
OpenGL-Demo PyOpenGL-Demo/redbook/drawf.py Lines: 81
{GPL} Scocca scocca/frontend/blender/elements.py Lines: 206
glRasterPos3f
OpenGLContext OpenGLContext/scenegraph/text/font.py Lines: 331, 346, 361
{LGPL} VisionEgg VisionEgg/Text.py Lines: 268
Previous: glPushName Table of Contents (GL) Next: glReadBuffer