Sign in to follow this  

Create a file from a texture?

This topic is 3722 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
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

This topic is 3722 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this