Texture format convertion.

Started by
0 comments, last by Adam_42 12 years ago
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:

  • D3DImage interop
  • Texture2D.ToStream(texture.Device.ImmediateContext, texture, ImageFileFormat.Bmp, stream);
  • Texture2D.SaveToFile(texture.Device.ImmediateContext, texture, ImageFileFormat.Bmp, "tmp.bmp");

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?
Advertisement
You could try making use of squish to compress the texture. It might be simpler than going via D3D, although you'll need to sort out your own DDS file header.

This topic is closed to new replies.

Advertisement