Microsoft DirectX 8.0 (Visual Basic)

Selecting and Displaying a Mipmap

Call the Direct3DDevice8.SetTexture method to set the mipmap texture set as the first texture in the list of current textures. For more information, see Multiple Texture Blending.

After your application selects the mipmap texture set, it must assign values from the CONST_D3DTEXTUREFILTERTYPE enumerated type to the D3DTSS_MIPFILTER texture stage state. Microsoft® Direct3D® then automatically performs mipmap texture filtering. Enabling mipmap texture filtering is demonstrated in the following code example.

m_D3D.SetTexture(0, DDMipMap)
m_D3D.SetTextureStateState(0, D3DTSS_MIPFILTER, D3DTEXF_POINT)

Your application can also manually traverse a chain of mipmap surfaces by using the Direct3DTexture8.GetSurfaceLevel method and specifying the mipmap level to retrieve. The following example traverses a mipmap chain from highest to lowest resolutions.

Dim DDLevel As Direct3DSurface8
Dim cLevels As Long

cLevels = DDMipMap.GetLevelCount

For iLevel = 0 to cLevels
    Set DDLevel = DDMipMap.GetSurfaceLevel(iLevel)

    'Process this level.

    Set DDLevel = Nothing
Next

Applications must manually traverse a mipmap chain to load bitmap data into each surface in the chain. This is typically the only reason to traverse the chain. An application can retrieve the number of levels in a mipmap texture by calling Direct3DBaseTexture8.GetLevelCount.