即贴图
一.加载图片资源
二.设置当前纹理
SetTexture方法
D3DXCreateTextureFromFile(
Device,
"dx5_logo.bmp",
&Tex);
Device->SetTexture(0, Tex);
三.纹理过滤器
两种情况:放大和缩小
三种设置方式
//
// Values for D3DSAMP_***FILTER texture stage states
//
typedef enum _D3DTEXTUREFILTERTYPE
{
D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only)
D3DTEXF_POINT = 1, // nearest
D3DTEXF_LINEAR = 2, // linear interpolation
D3DTEXF_ANISOTROPIC = 3, // anisotropic
D3DTEXF_PYRAMIDALQUAD = 6, // 4-sample tent
D3DTEXF_GAUSSIANQUAD = 7, // 4-sample gaussian
/* D3D9Ex only -- */
#if !defined(D3D_DISABLE_9EX)
D3DTEXF_CONVOLUTIONMONO = 8, // Convolution filter for monochrome textures
#endif // !D3D_DISABLE_9EX
/* -- D3D9Ex only */
D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DTEXTUREFILTERTYPE;
设置方法
Device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
Device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
四.渐进纹理链
即一个图片一下子缩小到很小就可能会产生较大差异化,逐步减小以尽量保持原图质量
设置多级渐进纹理过滤器