Last Updated March 3, 2010
In OpenGL, the term stiplling refers to the process of drawing a polygon through a mask. The mask are 32x32 bits. See this page for how to create complex masks.
GLubyte stipple[128]; // create a 32x32 (1024) array of bits (128 bytes= 1024 bits) for(int i=0;i<128;){ // populate array with stipple pattern stipple[i++]=85;stipple[i++]=85;stipple[i++]=85;stipple[i++]=85;// evenrow, 85=01010101 stipple[i++]=170;stipple[i++]=170;stipple[i++]=170;stipple[i++]=170;// odd row,170=10101010 }
Switch on/off polygon stippling using glEnable(GL_POLYGON_STIPPLE)/glDisable(GL_POLYGON_STIPPLE). Select a stipple pattern with glPolygonStipple(stipple).
In OpenGL, the alpha mask is controlled by the functions glEnable(GL_ALPHATEST) & glAlphaFunc(). glAlphaFunc() is used to set the test for drawing or discarding a pixel.
OpenGL functions related to translucency;
Chapter 6 of the OpenGL programming guide discusses blending in more detail.
© Ken Power 1996-2016