[ Previous | Next | Contents | Glossary | Home | Search ]
GL3.2 Version 4.1 for AIX: Programming Concepts

Backfacing Polygon Removal

Another method of hidden surface removal supported by GL is backfacing polygon removal. For many objects, including all convex polygonal 3-D figures, if each polygonal face is drawn in counterclockwise order when viewed from outside the object, then after transformation, the faces on the front are in counterclockwise order and those on the back in clockwise order. The system can be put in a mode where only counterclockwise polygons are drawn. For cases such as this, the 3-D figures are correctly rendered with hidden surfaces removed.

A backfacing polygon is defined as a polygon whose vertices appear in clockwise order in screen space. When backfacing polygon removal is turned on, the only polygons displayed are those in which the vertices appear in counterclockwise order, that is, polygons that point toward you. Therefore, all polygon vertices should be specified in counterclockwise order.

backface Subroutine

The backface subroutine initiates or terminates backfacing polygon removal. It is used to improve the performance of programs that represent solid shapes as collections of polygons. The vertices of the polygons on the far side of the solid are in clockwise order and are not drawn.

The backface subroutine takes a single parameter. A value of True enables backfacing polygon elimination and False (the default) disables it. The syntax is as follows:

void backface(Int32 bool)

getbackface Subroutine

The getbackface subroutine returns the state of backfacing filled polygon removal: 1 if removal is enabled, 0 if disabled.

The backfacing polygon removal is not as general as z-buffering. However, it can be useful for drawing polygons whose front side is drawn with a different color and pattern than the back side. (The polygon would have to be drawn twice, with the vertices in reversed order the second time.) The syntax is as follows:

Int32 getbackface()

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