Sign in to follow this  
kavitha

DDS files !!

Recommended Posts

hello all, can i know the internal format of DDS files. like incase of JPEG files....the image array can be manipulated as width * height * number of channels. i am trying to flip the images in the way i want, upside down !!....but i can't figure out the internal image array format for DDS files....Is there a pattern followed in the image array of DDS files....that is exactly i want to know to manipulate the contents. all i have is 2 variables that control the imageBufferSize...dwPitchorLinearSize if mipMapCount = 1 or imageBufferSize = dwPitchorLinearSize * factor if mipMapCount > 1. help me out !! .kavitha p.s:: am doing this just coz i am getting the image flipped upside down or mirrored along x-plane; my reader seems to be fine....any inputs on this !!

Share this post


Link to post
Share on other sites
1) The format of DDS files is described in the DirectX SDK documentation.

The specific topic is located at:
DirectX Graphics ->
Reference ->
DDS File Reference


2) The online version of the same documentation is at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/ddsfilereference/ddsfileformat.asp?frame=true

Share this post


Link to post
Share on other sites
hi,

am actually using DIRECTX texture tool to view .DDS files;

i downloaded a program to read .dds files and the way, the downloaded program and DIRECTX tool displays the .dds files are horizontally mirrored. or the image is flipped upside down along the horizontal plane.

any help on that ?. anybody tried reading .dds files and show me a link to a sample that reads in the proper way.

.kavitha

Share this post


Link to post
Share on other sites
i used the code from codesampler site only. and i find the textures need to be flipped vertically.

any idea of how to configure the loader to flip the images vertically.

thanks,

kavitha

Share this post


Link to post
Share on other sites
have you tried that and got it working !!...I tried that but i don't seem to get them rendered.

2D array, u meant an array going width * height. could u elaborate on this ?

thanks,

kavitha

Share this post


Link to post
Share on other sites
Well, since DDS images are compressed, you cannot load them backwards directly from the file, but I guess you know that?
You need to decompress them into width*height*channels array and then swap the height rows (lower to upper all the way) to get a flipped image - that would be the generel way to flip an image vertically. Then you can compress them again and load it like you want to.
I'm almost sure that it can be done faster using DDS's compression algorithms, but since I haven't looked at them yet (I have the same problem as you, so I need to find a solution anyways) I can't tell you much more other than I will be follwing this topic :-P

Share this post


Link to post
Share on other sites
hey nife,

did you look @ Nvidia SDK, it seems they do flip the image on the fly. i don't know how it is possible, check out their DDS files,you can infer from them. let me know if you find any interesting clues.

thanks,

kavitha

Share this post


Link to post
Share on other sites
Of course I have looked through NVIDIA's SDK - who hasn't? ;-)

But it's not for certain that they flip them like you think - they could just as easily change the texture coordinates instead.
But since I don't want to change the tex coords for every DDS image (or make them upside down) I need to do it at load time.. But I'll inform you when I have a solution - untill then you can always just change DDS files' coordinates...

Share this post


Link to post
Share on other sites
i don't think they flip the texture coordinates of DDS files. check out their DDS library source nv_dds.cpp & .h, it seems they flip during the load.

check it out !!

.kavitha

Share this post


Link to post
Share on other sites

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