SAMPLE: Mipmapping in the Direct3D HAL and HEL

Last reviewed: September 5, 1997
Article ID: Q169294
The information in this article applies to:
  • Microsoft DirectX 3 Software Development Kit, version 3.0

SUMMARY

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 Software Library:

 ~ D3dmip.exe (size: 69961 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

MORE INFORMATION

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.

Keywords          : GdiDirect3D kbfile kbsample
Technology        : kbDirectXSDK
Version           : 3.0
Platform          : WINDOWS


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.