March 2013
Intermediate to advanced
984 pages
26h 18m
English
Instead of an image, a texture can hold depth and stencil values, one of each per texel, using the texture format GL_DEPTH_STENCIL. This is the typical way a framebuffer will store the rendered z component for depth and the stencil value, as discussed in detail in Chapter 4, “Color, Pixels, and Framebuffers”. When texturing from a depth-stencil texture, by default a shader will read the depth. However, as of version 4.3, a shader can also read the stencil value. To do so, the application must set GL_DEPTH_STENCIL_TEXTURE_MODE to GL_STENCIL_COMPONENTS and the shader must use an integer sampler type.