View Full Version : Fail to load DDS with NV_DDS utility under linux

05-21-2013, 12:59 AM
Hi All. I posted this (http://stackoverflow.com/questions/16645040/cant-read-dds-image-header-on-linux) question on SO but got no answer so I am asking it here.Hopefully someone can shed some light.I am using nvidia DDS load utility to load DDS (DXT5).On windows 7 it works great.But now I cross compile my engine on Linux platform (Ubuntu 12.10)
and it fails at DDS header read.

This block :

// open file FILE *fp = fopen(filename.c_str(),"rb");
if (fp == NULL) {
return false;
// read in file marker, make sure its a DDS file

char filecode[4];
fread(filecode, 1, 4, fp);
if (strncmp(filecode, "DDS ", 4) != 0) {
return false;

// read in DDS header

fread(&ddsh, 1,sizeof( DDS_HEADER ), fp);//sizeof( DDS_HEADER )

First fread() reads the "magic word" all right.But the second one fills ddsh header struct with wrong data.How can it be? The utility is said to be Windows/Linux compatible.Maybe the header size is interpreted differently between the platforms?Anyone can test it on Ubuntu and confirm it works or not ?Thanks.