DirectX SDK |
The stencil buffer enables or disables drawing to the rendering target surface on a pixel-by-pixel basis. At its most fundamental level, it enables applications to mask off sections of the rendered image so that it is not displayed. Applications often use stencil buffers for special effects such as dissolves, decaling, and outlining. For details, see Stencil Buffer Techniques.
Stencil buffer information is embedded in the z-buffer data. Your application can test the user's hardware to see if it supports stencil buffers by invoking the IDirect3D7::EnumZBufferFormats method. The method passes depth-buffer formats, in the form of DDPIXELFORMAT structures, to your application. The relevant information is in the dwZBufferBitDepth, dwStencilBitDepth, dwZBitMask, and dwStencilBitMask members.
Stencil buffer information is embedded in the z-buffer data. Your application can test the user's hardware to see if it supports stencil buffers by calling the Direct3D7.GetEnumZBufferFormats method, then using the returned Direct3DEnumPixelFormats object to retrieve information about each supported depth-buffer pixel format. The Direct3DenumPixelFormats.GetItem method retrieves depth-buffer formats, in the form of a DDPIXELFORMAT type each, to your application. The relevant information is in the lZBufferBitDepth, lStencilBitDepth, lZBitMask, and lStencilBitMask members.