Name
gl.RasterPos -- specify the raster position for pixel operations
Synopsis
gl.RasterPos(x, y[, z, w])
Function
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 gl.Bitmap for details. See gl.DrawPixels for details. See gl.CopyPixels for details.

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.

The object coordinates presented by gl.RasterPos() are treated just like those of a gl.Vertex() 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 gl.Light(), gl.LightModel(), and gl.ShadeModel()). 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, #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 gl.TexGen for details.). 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.

The raster position is modified by gl.RasterPos() and gl.Bitmap().

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 gl.DrawElements() may leave the current color or index indeterminate. If gl.RasterPos() is executed while the current color or index is indeterminate, the current raster color or current raster index remains indeterminate.

Alternatively, gl.RasterPos() can also be called with a single table argument containing two to four coordinates to set as the new raster position.

Please consult an OpenGL reference manual for more information.

Inputs
x
specify the x object coordinates for the raster position
y
specify the y object coordinates for the raster position
z
optional: specify the z object coordinates for the raster position (defaults to 0)
w
optional: specify the w object coordinates for the raster position (defaults to 1)
Errors
#GL_INVALID_OPERATION is generated if gl.RasterPos() is executed between the execution of gl.Begin() and the corresponding execution of gl.End().

Associated gets
gl.Get() with argument #GL_CURRENT_RASTER_POSITION

gl.Get() with argument #GL_CURRENT_RASTER_POSITION_VALID

gl.Get() with argument #GL_CURRENT_RASTER_DISTANCE

gl.Get() with argument #GL_CURRENT_RASTER_COLOR

gl.Get() with argument #GL_CURRENT_RASTER_INDEX

gl.Get() with argument #GL_CURRENT_RASTER_TEXTURE_COORDS


Show TOC