Sign in to follow this  

Texture format convertion.

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

I'm trying to do something that, i guess, is fairly simple. But yet i can't get any working result.

I'm to loading an image (jpg, png, bmp,..., dds) into a Texture2D.
then i do some operations on it like creating a normalmap, or generating mip maps etc.
and after those operations i want to show output in a WPF application
when the user then accepts the final image, it gets saved as a dds file.

and everything works, except the outputting.

I tried a few different methods:[list]
[*]D3DImage interop
[*]Texture2D.ToStream(texture.Device.ImmediateContext, texture, ImageFileFormat.Bmp, stream);
[*]Texture2D.SaveToFile(texture.Device.ImmediateContext, texture, ImageFileFormat.Bmp, "tmp.bmp");
[/list]
results: it works, but only for R8B8G8A8_UNorm formats, not for BC*_UNorm

i've also tried with LoadTextureFromTexture to convert it first to R8B8G8A8, but that doesn't seem to be working either.

is there any way i can set this up without having to create a render target, a fullscreen quad and issue some(/one) drawcalls?

Share this post


Link to post
Share on other sites
You could try making use of [url="http://code.google.com/p/libsquish/"]squish[/url] to compress the texture. It might be simpler than going via D3D, although you'll need to sort out your own DDS file header.

Share this post


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