DDS files !!

Started by
10 comments, last by kavitha 18 years, 10 months ago
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 !!
Advertisement
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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

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
See the link below, this may help:
http://www.codesampler.com/oglsrc/oglsrc_4.htm#ogl_dds_texture_loader
You can download the tools from nvidia and you'll find an example with full sources there. So you may try to understand the format.
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
Load them backwards --- start at the end of the 2D array and move toward the top.

GDNet+. It's only $5 a month. You know you want it.

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
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
Killers don't end up in jailThey end up on a high-score!
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

This topic is closed to new replies.

Advertisement