The information in this article applies to:
SUMMARYA texture in Direct3D immediate mode is stored in a DirectDraw surface with the DDSCAPS_TEXTURE flag set in the dwCaps field of the DDSCAPS structure. Since the textures are stored in DirectDraw surfaces, you can alter the bits in these surfaces to perform texture animation in your Direct3D applications. To make changes to the pixels in a texture, you would lock down the DirectDraw surface associated with that texture with Lock() and then you would make the changes necessary. You would then load the revised texture on the video card when 3-D hardware is used with IDirect3DTexture::Load(). The next time the execute buffer is executed with IDirect3DDevice::Execute(), the revised texture will be used when rendering. MORE INFORMATION
It is important to create a source texture DirectDraw surface in system
memory and a destination DirectDraw surface (in video memory, if 3D
hardware is present). The source surface should be created with the
DDSCAPS_TEXTURE flag set and it should be created in system memory. The destination texture surface should be created with both the DDSCAPS_TEXTURE
and DDSCAPS_ALLOCONLOAD flags set. The destination surface will created
initially empty. You should call QueryInterface() on both the source and destination textures to get the IDirect3DTexture interface for the texture surfaces. After you have loaded the source texture surface with the bitmap data desired, you should call the destination texture's
IDirect3DTexture::Load() method, specifying the source texture, to load the
texture onto the destination surface. You can now call the destination
texture's IDirect3DTexture::GetHandle() method to obtain a Direct3D texture
handle to be used in the execute buffer. When you are done with your
texture animation and these textures and surface are no longer required,
you should call Release() on the source and destination textures as well as the source and destination surfaces.
Sample CodeHere is a code example to implement the steps above:
Additional query words:
Keywords : kbDirect3dIM KbDirectX kbWinOS95 kbfaq kbDirectX200 kbDirect3D |
Last Reviewed: January 21, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |