glBitmap function

The glBitmap function draws a bitmap.

Syntax

void WINAPI glBitmap(
         GLSizei width,
         GLSizei height,
         GLfloat xorig,
         GLfloat yorig,
         GLfloat xmove,
         GLfloat ymove,
   const GLubyte *bitmap
);

Parameters

width

The pixel width of the bitmap image.

height

The pixel height of the bitmap image.

xorig

The x location of the origin in the bitmap image. The origin is measured from the lower-left corner of the bitmap, with right and up directions being the positive axes.

yorig

The y location of the origin in the bitmap image. The origin is measured from the lower-left corner of the bitmap, with right and up directions being the positive axes.

xmove

The x offset to be added to the current raster position after the bitmap is drawn.

ymove

The y offset to be added to the current raster position after the bitmap is drawn.

bitmap

The address of the bitmap image.

Return value

This function does not return a value.

Error codes

The following error codes can be retrieved by the glGetError function.

Name Meaning
GL_INVALID_VALUE
width or height is negative.
GL_INVALID_OPERATION
The function was called between a call to glBegin and the corresponding call to glEnd.

Remarks

A bitmap is a binary image. When drawn, the bitmap is positioned relative to the current raster position, and framebuffer pixels corresponding to 1s in the bitmap are written using the current raster color or index. Frame-buffer pixels corresponding to zeros in the bitmap are not modified.

The bitmap image is interpreted like image data for the glDrawPixels function, with width and height corresponding to the width and height arguments of that function, and with type set to GL_BITMAP and format set to GL_COLOR_INDEX. Modes you specify using glPixelStore affect the interpretation of bitmap image data; modes you specify using glPixelTransfer do not.

If the current raster position is invalid, glBitmap is ignored. Otherwise, the lower-left corner of the bitmap image is positioned at the following window coordinates:

xw = xr x?

yw = yr y?

In these coordinates, (xr , yr ) is the raster position, and (x? , y? ) is the bitmap origin. Fragments are then generated for each pixel corresponding to a 1 in the bitmap image. These fragments are generated using the current raster z-coordinate, color or color index, and current raster texture coordinates. They are then treated just as if they had been generated by a point, line, or polygon, including texture mapping, fogging, and all per-fragment operations such as alpha and depth testing.

After the bitmap has been drawn, the x and y coordinates of the current raster position are offset by xmove and ymove. No change is made to the z-coordinate of the current raster position, or to the current raster color, index, or texture coordinates.

The following functions retrieve information related to the glBitmap function:

glGet with argument GL_CURRENT_RASTER_POSITION

glGet with argument GL_CURRENT_RASTER_COLOR

glGet with argument GL_CURRENT_RASTER_INDEX

glGet with argument GL_CURRENT_RASTER_TEXTURE_COORDS

glGet with argument GL_CURRENT_RASTER_POSITION_VALID

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Gl.h
Library
Opengl32.lib
DLL
Opengl32.dll

See also

glBegin

glDrawPixels

glEnd

glPixelStore

glPixelTransfer

glRasterPos