Jump to content
  • Advertisement
Sign in to follow this  
Dookie

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
Advertisement
Hello,

I think this could help you.



// your texture
IDirect3DTexture9 *texture;

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





Supported file formats:


D3DXIFF_BMP
Windows bitmap (BMP) file format.
D3DXIFF_JPG
Joint Photographics Experts Group (JPEG) compressed file format.
D3DXIFF_TGA
Truevision (Targa, or TGA) image file format.
D3DXIFF_PNG
Portable Network Graphics (PNG) file format.
D3DXIFF_DDS
DirectDraw surface (DDS) file format.
D3DXIFF_PPM
Portable pixmap (PPM) file format.
D3DXIFF_DIB
Windows device-independent bitmap (DIB) file format.
D3DXIFF_HDR
High dynamic range (HDR) file format.
D3DXIFF_PFM
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!