[ Previous | Next | Contents | Glossary | Home | Search ]
OpenGL 1.1 for AIX: Reference Manual

glRasterPos Subroutine


Specifies the raster position for pixel operations.


OpenGL C bindings library: libGL.a

C Syntax

void glRasterPos2d(GLdouble X, 
    GLdouble Y)
void glRasterPos2f(GLfloat X, 
                                 GLfloat Y)
void glRasterPos2i(GLint X, 
   GLint Y)
void glRasterPos2s(GLshort X, 
    GLshort Y)
void glRasterPos3d(GLdouble X, 
    GLdouble Y,
    GLdouble Z)
void glRasterPos3f(GLfloat X, 
   GLfloat Y,
   GLfloat Z)
void glRasterPos3i(GLint X, 
   GLint Y,
   GLint Z)
void glRasterPos3s(GLshort X, 
    GLshort Y,
    GLshort Z)
void glRasterPos4d(GLdouble X, 
   GLdouble Y,
   GLdouble Z,
   GLdouble W)
void glRasterPos4f(GLfloat X, 
   GLfloat Y,
   GLfloat Z,
   GLfloat W)
void glRasterPos4i(GLint X, 
   GLint Y,
   GLint Z,
   GLint W)
void glRasterPos4s(GLshort X, 
   GLshort Y,
   GLshort Z,
   GLshort W)
void glRasterPos2dv(const GLdouble *V)
void glRasterPos2fv(const GLfloat *V)
void glRasterPos2iv(const GLint *V)
void glRasterPos2sv(const GLshort *V)
void glRasterPos3dv(const GLdouble *V)
void glRasterPos3fv(const GLfloat *V)
void glRasterPos3iv(const GLint *V)
void glRasterPos3sv(const GLshort *V)
void glRasterPos4dv(const GLdouble *V)
void glRasterPos4fv(const GLfloat *V)
void glRasterPos4iv(const GLint *V)
void glRasterPos4sv(const GLshort *V)


X, Y, Z, W Specify the x, y, z, and w object coordinates (if present) for the raster position.
V Specifies a pointer to an array of two, three, or four elements, specifying x, y, z, and w coordinates, respectively.


The GL maintains a 3-dimensional (3D) position in window coordinates. This position, called the raster position, is maintained with subpixel accuracy. It is used to position pixel and bitmap write operations. (See the glBitmap subroutine for information on drawing bitmaps; the glCopyPixels subroutine for information on copying pixels to the frame buffer; and the glDrawPixels subroutine for information on writing a block of pixels to the frame buffer.)

The current raster position consists of four window coordinates (X, Y, Z, W), a valid bit, and associated color data and texture coordinates. The W coordinate is actually a clip coordinate, because W is not projected to window coordinates. The glRasterPos4 subroutine specifies object coordinates X, Y, Z, and W explicitly. The glRasterPos3 subroutine specifies object coordinates X, Y, and Z explicitly, while W is implicitly set to 1 (one). The glRasterPos2 subroutine uses the argument values for X and Y while implicitly setting Z and W to 0 (zero) and 1.

The object coordinates presented by glRasterPos are treated just like those of a glVertex subroutine: they are transformed by the current modelview and projection matrices and passed to the clipping stage. If the vertex is not culled, 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, 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, GL_CURRENT_RASTER_COLOR in red, green, blue, alpha (RGBA) mode or the GL_CURRENT_RASTER_INDEX in color index mode is set to the color produced by the lighting calculation. (See the glLight subroutine for information on setting light source parameters; the glLightModel subroutine for information on setting lighting model parameters; and the glShadeModel subroutine for information on selecting flat or smooth shading.) 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.

Likewise, the GL_CURRENT_RASTER_TEXTURE_COORDS is updated as a function of the GL_CURRENT_TEXTURE_COORDS, based on the texture matrix and the texture generation functions. (See the glTexGen subroutine for information on generating texture coordinates.)

Initially, the current raster position is (0,0,0,1), 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.


The raster position is modified both by glRasterPos and by glBitmap.

When the raster position coordinates are not valid, drawing commands that are based on the raster position are ignored (that is, they do not result in changes to GL state).


GL_INVALID_OPERATION The glRasterPos subroutine is called between a call to glBegin and the corresponding call to glEnd.

Associated Gets

Associated gets for the glRasterPos subroutine are as follows. (See the glGet subroutine for more information.)



glGet with argument GL_CURRENT_RASTER_COLOR

glGet with argument GL_CURRENT_RASTER_INDEX



/usr/include/GL/gl.h Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL.

Related Information

The glBegin or glEnd subroutine, glBitmap subroutine, glCopyPixels subroutine, glDrawPixels subroutine, glLight subroutine, glLightModel subroutine, glShadeModel subroutine, glTexCoord subroutine, glTexGen subroutine, glVertex subroutine.

OpenGL Overview.

[ Previous | Next | Contents | Glossary | Home | Search ]