Opengl programmingstencil buffer wikibooks, open books. Opengl es is the standard graphics api used for mobile and embedded systems. Stencil buffer values are treated as unsigned integers. Where a 1 appears in the mask, its possible to write to the corresponding bit in the stencil buffer.
Opengl programmingminiportal recursive wikibooks, open. This book is intended for programmers interested in learning opengl es. Opengl es is a complicated subject at the best of times but this book does an excellent job of explaining the principles and concepts of opengl es to an absolute beginner. The following example illustrates using glstencilfunc and glstencilop to control rendering. Despite its widespread use, there is a lack of material that addresses the balance of both theory and practice in opengl es. Stencil operations in opengl adjust glstencilop function that expects three values. It is difficult to understand what is wrong when working on the stencil buffer, because we have no direct way to see it.
The most recent red book parallels the grand tradition of opengl. The least significant n bits of mask, where n is the number of bits in the stencil buffer, specify a mask. The following example illustrates using glstencilfunc and glstencilop to control. If you use opengl nones, you can call glreadpixels to grab the whole stencil buffer and inspect it externally, but its tedious. This money will help me to travel to python conferences and to write other books as well. Specifies the action to take when the stencil test fails. A stencil buffer is an extra data buffer, in addition to the color buffer and zbuffer, found on.
481 258 1654 194 210 361 196 1292 1067 1328 276 354 403 489 327 421 1310 287 217 1348 136 1332 572 939 848 1348 926 397 1170 319 1381 985 556 1041 962 815 125 47 803