Porting Screen and Buffer Clearing Commands

OpenGL replaces a variety of IRIS GL clear functions (such as zclear, aclear, sclear, and so on) with a single function, glClear. Specify exactly what you want to clear by passing masks to glClear.

Keep the following points in mind when porting screen and buffer commands:

  • OpenGL maintains clearing colors separately from drawing colors, with calls like glClearColor and glClearIndex. Be sure to set the clear color for each buffer before clearing.

  • Instead of using one of several differently named clear calls, you now clear several buffers with one call, glClear, by OR ing together buffer masks. For example, czclear is replaced by:

  • IRIS GL references the polygon stipple and the color writemask. OpenGL ignores the polygon stipple but references the color writemask. (The czclear function ignores both the polygon stipple and the color writemask.)

The following table lists the various IRIS GL clear functions with their equivalent OpenGL functions.

IRIS GL call OpenGL call Meaning
acbuf(AC_CLEAR) glClear( GL_ACCUM_BUFFER_BIT ) Clear the accumulation buffer.
glClearColor Set the RGBA clear color.
glClearIndex Set the clear-color index.
clear glClear( GL_COLOR_BUFFER_BIT ) Clear the color buffer.
glClearDepth Specify the clear value for the depth buffer.
zclear glClear( GL_DEPTH_BUFFER_BIT ) Clear the depth buffer.
Clear the color buffer and the depth buffer.
glClearAccum Specify clear values for the accumulation buffer.
glClearStencil Specify the clear value for the stencil buffer.
sclear glClear( GL_STENCIL_BUFFER_BIT ) Clear the stencil buffer.

When your IRIS GL code uses both gclear and sclear, you can combine them into a single glClear call; can improve your program's performance.