Microsoft KB Archive/169294

From BetaArchive Wiki

Mipmapping in the Direct3D HAL and HEL

ID: Q169294

The information in this article applies to:

  • Microsoft DirectX Software Development Kit, version 3.0


The D3DMIP Direct3D Immediate Mode example application demonstrates how to create a mipmapped texture using a source and destination DirectDraw surface.

A mipmap is a sequence of textures, each of which is a representation of the same image at varying resolutions. The sequence of textures in a mipmap are progressively lower in resolution and each image in the mipmap is a power of two smaller than the previous level. The D3DMIP sample demonstrates how to create and use a mipmapped sequence of textures in the HEL and in the HAL.

The following file is available for download from the Microsoft Download Center. Click the file name below to download the file:


For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address

and then click How to use the Microsoft Download Center.


D3DMIP shows how to create a mipmapped texture surface and mipmapped texture object from a series of three BMP files. There are three levels in the mipmap and, consequently, three DirectDraw surfaces in the complex surface are created for the mipmap. The creation of the mipmap is done in a two step process. A source texture surface is created in system memory and a source texture object is created by calling QueryInterface() on that surface. A second, initially empty, DirectDraw texture surface is created in video memory if 3D accelerated hardware was selected. If using the HEL, the second surface is created in system memory. A second texture object, the destination texture, is created based off of this surface. The source texture is loaded into the destination texture surface with a call to IDirect3DTexture::Load() and then discarded. This process allows a 3D accelerated device to compress a texture map as it enters video memory during the IDirect3DTexture::Load() call. The creation of textures must be done in this manner. For further example code on the creation of source and destination texture objects and texture surfaces, look at file "texture.c" in the "misc" directory of the DirectX SDK samples.

Additional query words:

Keywords : kbfile kbsample KbDirectX300 kbSDKWin32
Version : WINDOWS:3.0
Platform : WINDOWS
Issue type : kbinfo

Last Reviewed: December 4, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.