Microsoft DirectX 9.0

Volume Texture Sample


The Volume Texture sample illustrates how to use the new volume textures in Microsoft?Direct3D? Normally, a texture is thought of as a 2-D image, which has a width and a height and whose texels are addressed with two coordinate, tu and tv. Volume textures are the 3-D counterparts, with a width, height, and depth, are addressed with three coordinates, tu, tv, and tw.

You can use volume textures for interesting effects such as patchy fog, explosions, and so on.

Not all cards support all features for volume textures. For more information about volume textures, refer to the Microsoft DirectX® software development kit (SDK) documentation.


Source: (SDK root)\Samples\C++\Direct3D\VolumeTexture

Executable: (SDK root)\Samples\C++\Direct3D\Bin

User's Guide

The following table lists the keys that are implemented. You can use menu commands for the same controls.

ENTERStarts and stops the scene.
SPACEBARAdvances the scene by a small increment.
F2Prompts the user to select a new rendering device or display mode.
ALT+ENTERToggles between full-screen and windowed modes.
ESCExits the application.

Programming Notes

Volume textures are no more difficult to use than 3-D textures. In this sample source code, note the vertex declaration, which has a third texture coordinate; texture creation, which also takes a depth dimension; and texture locking, again with the third dimension. The 3-D rasterizer interpolates texel values much as for 2-D textures.

This sample uses common DirectX code that consists of programming elements such as helper functions. This code is shared with other samples in the DirectX SDK. You can find the sample framework headers and source code in (SDK root)\DXSDK\Samples\C++\Common\Include and (SDK root)\DXSDK\Samples\C++\Common\Src.

© 2002 Microsoft Corporation. All rights reserved.