DirectX SDK

Texture Perspective State

[C++]

Applications can apply perspective correction to textures to make them fit properly onto primitives that diminish in size as they get farther away from the viewer. See D3DRENDERSTATE_TEXTUREPERSPECTIVE.

The following code fragment illustrates the process of enabling texture perspective correction:

// This code fragment assumes that lpD3DDevice is a valid pointer to
// an IDirect3DDevice7 interface.
 
// Enable texture perspective.
lpD3DDevice7->SetRenderState(D3DRENDERSTATE_TEXTUREPERSPECTIVE, 
                             TRUE);

For the IDirect3DDevice3 and IDirect3DDevice7 interfaces, the default value is TRUE to enable perspective correct texture mapping. For earlier interfaces, the default is FALSE. Note that many 3-D adapters apply texture perspective correction unconditionally. Perspective correction must be enabled to use w-based fog, and w-buffers. For more information, see Eye-relative vs. Z-Based Depth in the Fog section, and Enabling Depth Buffering in the Depth Buffers section.

[Visual Basic]

Applications can apply perspective correction to textures to make them fit properly onto primitives that diminish in size as they get farther away from the viewer. See D3DRENDERSTATE_TEXTUREPERSPECTIVE.

The following code fragment illustrates the process of enabling texture perspective correction:

' This code fragment assumes that d3dD3DDevice is a valid reference to
' a Direct3DDevice7 object.
 
' Enable texture perspective.
Call d3dDevice7.SetRenderState(D3DRENDERSTATE_TEXTUREPERSPECTIVE, _ 
                               True)

The default value is True to enable perspective correct texture mapping.

Note that many 3-D adapters apply texture perspective correction unconditionally. Perspective correction must be enabled to use w-based fog, and w-buffers. For more information, see Eye-relative vs. Z-Based Depth in the Fog section, and Enabling Depth Buffering in the Depth Buffers section.