[ Previous | Next | Contents | Glossary | Home | Search ]
GL3.2 for AIX: Graphics Library (GL) Technical Reference

backface Subroutine


Enables and disables backfacing polygon removals.


Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void backface(Int32 bool)




The backface subroutine allows or suppresses the display of backfacing filled polygons. With the frontface subroutine, it is useful for drawing polygons that have different colors on each side. The frontface subroutine can also be useful for performing a primitive kind of hidden surface removal.

A backfacing polygon is defined as a polygon whose vertices are in clockwise order in screen coordinates. When backfacing polygon removal is on, the system displays only polygons whose vertices are in counterclockwise order.

For programs representing solid objects as collections of polygons, this subroutine can be used to help remove hidden surfaces. The backface subroutine works best for simple convex objects that do not obscure other objects.

For complicated objects, this routine alone may not remove all hidden surfaces. To remove hidden surfaces for more complicated objects or groups of objects, use the zbuffer subroutine. The zbuffer subroutine checks the relative distances of the figure from the viewer (z values) and draws only the nearest figures.

If both frontfacing and backfacing polygon removal is enabled, no filled polygons are displayed. (An exception is made if the graphics pipeline cannot determine if a polygon is front- or backfacing because it is degenerate or otherwise exceptional.)

  1. Matrices that negate coordinates, such as scale(-1.0, 1.0, 1.0) , reverse the directional order of a polygon's points and can cause the backface subroutine to do the opposite of what is intended.
  2. If a polygon is extremely small or has degenerate vertices, the graphics pipeline cannot determine if the polygon is backfacing. In such cases, the polygon is rendered by default.


bool Specifies a value for the state of backfacing polygon removal. The settings for the bool parameter are:
False = backfacing polygon removal disabled.
True = backfacing polygon removal enabled.


The example C language program backface.c uses the backface subroutine to draw a cube two ways to demonstrate the difference between allowing or suppressing the display of backfacing polygons.

Implementation Specifics

This subroutine is part of GL in the AIXwindows Environment/6000 Version 1, Release 2 with AIXwindows Desktop/3D Feature.

On the POWERgraphics GTO adapter, either frontfacing polygon removal or backfacing polygon removal can be specified, but not both simultaneously. Enabling backfacing culling disables frontfacing culling.


/usr/include/gl/gl.h Contains C language constant and variable type definitions for GL.
/usr/include/gl/fgl.h Contains FORTRAN constant and variable type definitions for GL.

Related Information

Initiating z-buffer mode with the zbuffer subroutine.

AIX Graphics Library Overview and Removing Hidden Surfaces.

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