Jump to content
  • Advertisement
Sign in to follow this  

Create a file from a texture?

This topic is 4087 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I'd like to know how to create a file from a texture... I'm using 'D3DXCreateTextureFromFileEx()' to create a texture in memory from a heightmap file (greyscale image), then using 'D3DXCreateTexture()' to dump it into a buffer that will later be turned into a normal map using 'D3DXComputeNormalMap()'. I'd like to dump the texture created by 'D3DXComputeNormalMap()' into a file (normalmap.tga, or something like that)... How do I do that? I have no idea where to start. Thanks in advance for the help!

Share this post

Link to post
Share on other sites

I think this could help you.

// your texture
IDirect3DTexture9 *texture;

D3DXSaveTextureToFile("texture.bmp", D3DXIFF_BMP, texture, NULL);

Supported file formats:

Windows bitmap (BMP) file format.
Joint Photographics Experts Group (JPEG) compressed file format.
Truevision (Targa, or TGA) image file format.
Portable Network Graphics (PNG) file format.
DirectDraw surface (DDS) file format.
Portable pixmap (PPM) file format.
Windows device-independent bitmap (DIB) file format.
High dynamic range (HDR) file format.
Portable float map file format.

See msdn.microsoft.com for more details.

Mr X

[Edited by - Mr X on October 21, 2007 3:40:27 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!