Contents / Previous / Next


Positioning

The Current Raster Position

The current raster position is the origin where the next bitmap (or image) is to be drawn. In the F example, the raster position was set using glRasterPos*() to (20, 20), which is where the lower left corner of the F was drawn:
glRasterPos2i(20, 20);
void glRasterPos{234}{sifd}{v}(TYPE x, TYPE y, TYPE z, TYPE w);

Sets the current raster position. The x, y, z, and w arguments specify the coordinates of the raster position. If glRasterPos2*() is used, z is implicitly set to zero and w is implicitly set to one; similarly, with glRasterPos3*(), w is set to one.

The coordinates of the raster position are transformed to screen coordinates in exactly the same way as coordinates supplied with a glVertex*() command (that is, with the modelview and perspective matrices). After transformation, they either define a valid spot in the window on the screen, or they're clipped out because the transformed coordinates lie outside the viewport. If the transformed point is clipped out, the current raster position is invalid.

To obtain the current raster position, you can use the query command glGetFloatv() with GL_CURRENT_RASTER_POSITION as the first argument. The second argument should be a pointer to an allocated array that can hold the (x, y, z, w) values as floating-point numbers. Call glGetBooleanv() with GL_CURRENT_RASTER_POSITION_VALID as the first argument to determine whether the current raster position is valid.

Position in Window Coordinates

glWindowPos{23}{sifd}() is an alternative to position a bitmap directly in window coordinates:
public static void glWindowPos2i(int x, int y)

public static void glWindowPos3d(double x,
                                 double y,
                                 double z)
It does not calculate clipping, ligthing, or texture coordinates.