Sign in to follow this  

Copying DDS data to Texture Buffers

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

Greets all, I have succesfully managed to decode a TGA and copy its 24/32bit color data to a texture buffer perfectly. I can do the same with DDS 32 bit files too. My problem lies with DXTn compressed files. What is the process of copying their data to a texture buffer? Do I need to convert it to 32 bit then copy to the texture buffer? I understand it is compressed, but I also noticed that there are D3DFMT_DXT(n) formats. If used when creating a texture buffer, does this mean D3D does the de-compression? At the moment my code does not do de-compression, I took it from an nVidia GL sample which relied on a GL extension to do the de-compression. Any idea where I can find the decompression code? Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by Shock
My problem lies with DXTn compressed files. What is the process of copying their data to a texture buffer?

If you really want to do it manually, read the Compressed Texture Formats section in the SDK documentation..

Quote:
Original post by Shock
I understand it is compressed, but I also noticed that there are D3DFMT_DXT(n) formats. If used when creating a texture buffer, does this mean D3D does the de-compression?

When the hardware supports the use of DXTn formats it should be able to render directly from the compressed data. So you can store the data from the DXTn file directly in an IDirect3DTexture9 object. If the hardware doesn't support it (rare!) then yes, you will have to decode it to a supported format.


Although, as a general note - why are you writing manual file loaders? [smile]

It's a whole lot quicker/easier to use the stock D3DX Functions. Check out the D3DXCreateTexture**() functions from this list.

hth
Jack

Share this post


Link to post
Share on other sites
Thanks for the reply!

Quote:

Although, as a general note - why are you writing manual file loaders?


Hehe, I am also writing a OpenGL renderer so it needs to work with both API's.

Thanks, I am going to try and implement this now!

Share this post


Link to post
Share on other sites

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