View Full Version : S3TC question

10-15-2002, 09:03 PM
I downloaded some tuts from developers.nvidia.com and in its opengl section was the s3tc downloadable file, i glanced it and saw it using ddraw while using opengl???

does this mean i have to have the dx8/dx7 sdk to use the s3tc extension??? is there another way not to use the dx sdk?

thanks. (obviously, i've never tried this extension before -- so simpel sample code would be VEEERRRY nice, thanks)

10-15-2002, 09:32 PM
You can just use this header instead of that ddraw.h struct header in .dds files:

struct DdsHeader {
unsigned int ddsIdentifier;
unsigned char junk[8];
unsigned int height;
unsigned int width;

unsigned char junk2[8];
unsigned int nMipMaps;

unsigned char junk3[52];
unsigned int fourCC;
unsigned int bpp;
unsigned char junk4[36];

Edit: Formatting

[This message has been edited by Humus (edited 10-15-2002).]

10-15-2002, 11:43 PM
The Photoshop pluginn and commandline tool from nVidia to convert a bitmap to S3TC uses a DDS file to store the compressed bitmap. The S3TC standard only describes the compression algoritm but not the way how it should be stored. You can choose whatever you want as long as your engine loads it correctly.
A nice thing about the DDS surface file and the Nvidia tools, is that you can store mipmaps in the file, that makes loading and registering with OpenGL fast.
You don't need the latest D3D SDK to use this header, I believe the header of the DX lib included with VC6.0 is enough (I think it is DX2.0), but I ended out myself by copying the headerstruct in my engine.

[This message has been edited by tuxit (edited 10-16-2002).]

10-16-2002, 07:11 AM
ok, thanks, i'll try the structure instead of ddraw.h...if it won't work, then, well, i'll post here again soon.


10-16-2002, 08:03 AM
You can try the DDS loader that is used in the NVIDIA SDK.

Header: http://cvs1.nvidia.com/OpenGL/include/shared/nv_dds.h
Source: http://cvs1.nvidia.com/OpenGL/src/shared/nv_dds.cpp

Which can be used like so:

CDDSImage image;
if (image.load("myfile.dds"))

or for cubemaps like this:

if (image.load("mycubemap.dds"))

The loader supports uncompressed and compressed 2D, 3D, and cubemap textures, with or without mipmaps.