Jump to content

  • Log In with Google      Sign In   
  • Create Account


Texture format convertion.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 SGStino   Members   -  Reputation: 119

Like
0Likes
Like

Posted 12 April 2012 - 06:55 AM

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?

Sponsor:

#2 Adam_42   Crossbones+   -  Reputation: 2361

Like
0Likes
Like

Posted 13 April 2012 - 05:28 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS