Graphics Reference
In-Depth Information
value is written into a buffer, the buffer's mask is used to verify that the
buffer is writable.
For the color buffer, the glColorMask routine specifies which
components in the color buffer will be updated if a pixel is written.
If the mask for a particular component is set to GL_FALSE , that
component will not be updated if written to. By default, all color
components are writable.
void glColorMask (GLboolean red , GLboolean green ,
GLboolean blue , GLboolean alpha )
red, green, specify whether the particular color component
blue,
in the color buffer is modifiable while rendering
alpha
Likewise, writing to the depth buffer is controlled by calling
glDepthMask with GL_TRUE or GL_FALSE to specify whether the depth
buffer is writable.
Often, writing to the depth buffer is disabled when rendering translucent
objects. Initially, you would render all of the opaque objects in the scene
with writing to the depth buffer enabled (i.e., set to GL_TRUE ). This would
ensure that all of the opaque objects are correctly depth sorted, and the
depth buffer contains the appropriate depth information for the scene.
Then, before rendering the translucent objects, you would disable writing to
the depth buffer by calling glDepthMask (GL_FALSE) . While writing to the
depth buffer is disabled, values can still be read from it and used for depth
comparisons. This allows translucent objects that are obscured by opaque
objects to be correctly depth buffered, but does not modify the depth buffer
such that opaque objects would be obscured by translucent ones.
void glDepthMask (GLboolean depth )
depth specifies whether the depth buffer is modifiable
Finally, you can disable writing to the stencil buffer by calling
glStencilMask . Unlike with glColorMask or glDepthMask , you can
 
 
Search WWH ::




Custom Search