Game Development Reference
In-Depth Information
Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
}
// set mirror address mode
if( ::GetAsyncKeyState('M') & 0x8000f )
{
Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_MIRROR);
Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_MIRROR);
}
6.6 Sample Application: Textured Quad
The sample for this chapter demonstrates how to texture a quad and
set a texture filter (see Figure 6.9). A mipmap chain is created automat-
ically with the D3DXCreateTextureFromFile function if the device
supports mipmapping.
Figure 6.9:
A screen shot of a
textured quad taken
from the TexQuad
sample
Note: There are two additional samples on the web page for this
chapter. One sample textures a cube with the crate texture, as shown
in Figure 6.1. The second demonstrates texture address modes.
The tasks required for adding textures to a scene are:
1.
Construct the vertices of the objects with the texture coordinates
specified.
2.
Load a texture into an IDirect3DTexture9 interface using the
D3DXCreateTextureFromFile function.
3.
Set the minification, magnification, and mipmap filters.
4.
Before you draw an object, set the texture that is associated with
the object with IDirect3DDevice9::SetTexture .
Search WWH ::




Custom Search