Direct3D (DirectX 9.0) Code Samples - Page 3

Texture Mapping
 

Demonstrates basic texture mapping using a textured quad and a bitmap of some wooden floor tiles. Check out the OpenGL source code page for the OpenGL equivalent of this sample.

Relevant Keywords: D3DXCreateTextureFromFile, SetSamplerState, SetTexture, LPDIRECT3DTEXTURE9, D3DSAMP_MINFILTER, D3DSAMP_MAGFILTER, and D3DTEXF_LINEAR.

 

Texture Filtering
 

Demonstrates how to filter out unwanted graphical artifacts from Direct3D textures. Check out the OpenGL source code page for the OpenGL equivalent of this sample.

Relevant Keywords: D3DXCreateTextureFromFile, SetSamplerState, SetTexture, LPDIRECT3DTEXTURE9, D3DSAMP_MINFILTER, D3DSAMP_MAGFILTER, D3DTEXF_NONE, D3DTEXF_POINT, D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC, D3DTEXF_FLATCUBIC, and D3DTEXF_GAUSSIANCUBIC,

 

Texture Addressing
 

Demonstrates how texture addressing works under Direct3D by allowing the texture addressing mode to be changed at run-time with a textured quad whose texture coordinates range from 0.0 to 3.0. Check out the OpenGL source code page for the OpenGL equivalent of this sample.

Relevant Keywords: SetSamplerState, D3DSAMP_BORDERCOLOR, D3DSAMP_ADDRESSU, D3DSAMP_ADDRESSV, D3DSAMP_ADDRESSW, D3DTADDRESS_WRAP, D3DTADDRESS_CLAMP, D3DTADDRESS_MIRROR, D3DTADDRESS_BORDER, and D3DTADDRESS_MIRRORONCE.

 

Texture Sub-loading
 

Demonstrates how texture sub-loading works under Direct3D by copying a smaller texture over the texel data of a larger texture. Check out the OpenGL source code page for the OpenGL equivalent of this sample.

Relevant Keywords: D3DXCreateTextureFromFile, D3DXLoadSurfaceFromSurface, LPDIRECT3DSURFACE9, LPDIRECT3DTEXTURE9, and D3DX_DEFAULT

 

Texture Mip-mapping
 

This sample demonstrates how mip-mapping works under Direct3D by tiling a single textured quad across a 25x25 unit area. The original texture is simply white with a thin black border, but in a effort to show mip-mapping in action, several mip-map levels have been altered by replacing the auto generated mip-map texture for that level with a color-coded version. This causes mip-map filtering to produce rainbow colored bands which radiate across the surface as the eye point moves about. Check out the OpenGL source code page for the OpenGL equivalent of this sample.

Relevant Keywords: SetSamplerState, D3DXCreateTextureFromFile, D3DXLoadSurfaceFromSurface, LPDIRECT3DSURFACE9, LPDIRECT3DTEXTURE9, D3DX_DEFAULT, D3DSAMP_MINFILTER, D3DSAMP_MAGFILTER, D3DSAMP_MIPFILTER, D3DTEXF_NONE, D3DTEXF_POINT, D3DTEXF_LINEAR, and D3DTEXF_ANISOTROPIC.