11 #define DDS_ERROR_NONE 0 // everything went fine
12 #define DDS_ERROR_INVALID_FILENAME 1 // bad or missing file
13 #define DDS_ERROR_UNSUPPORTED 2 // a known format but one we don't support
14 #define DDS_ERROR_INVALID_FORMAT 3 // format that's not supported
15 #define DDS_ERROR_BAD_HEADER 4 // header was not "DDS "
16 #define DDS_ERROR_NO_COMPRESSION 5 // file is compressed, compression isn't supported
17 #define DDS_ERROR_NON_POWER_OF_2 6 // file is not a power of 2 in dimensions
18 #define DDS_ERROR_CUBEMAP_FACES 7 // file is a cubemap, but doesn't have all six faces
21 #define DDS_DXT_INVALID -1
22 #define DDS_UNCOMPRESSED 0
26 #define DDS_CUBEMAP_UNCOMPRESSED 10
27 #define DDS_CUBEMAP_DXT1 11
28 #define DDS_CUBEMAP_DXT3 13
29 #define DDS_CUBEMAP_DXT5 15
32 #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
33 ((uint)(ubyte)(ch0) | ((uint)(ubyte)(ch1) << 8) | \
34 ((uint)(ubyte)(ch2) << 16) | ((uint)(ubyte)(ch3) << 24 ))
35 #endif //defined(MAKEFOURCC)
38 #define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1'))
39 #define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2'))
40 #define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3'))
41 #define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4'))
42 #define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5'))
44 #define DDS_FILECODE 0x20534444 // "DDS " in file
47 #define DDSD_LINEARSIZE 0x00080000
48 #define DDSD_PITCH 0x00000008
49 #define DDPF_ALPHAPIXELS 0x00000001
50 #define DDPF_FOURCC 0x00000004
51 #define DDPF_PALETTEINDEXED4 0x00000008
52 #define DDPF_PALETTEINDEXEDTO8 0x00000010
53 #define DDPF_PALETTEINDEXED8 0x00000020
54 #define DDPF_RGB 0x00000040
55 #define DDSD_PIXELFORMAT 0x00001000
56 #define DDSD_WIDTH 0x00000004
57 #define DDSD_HEIGHT 0x00000002
58 #define DDSD_CAPS 0x00000001
59 #define DDSD_MIPMAPCOUNT 0x00020000
61 #define DDSCAPS_COMPLEX 0x00000008
62 #define DDSCAPS_PRIMARYSURFACE 0x00000200
63 #define DDSCAPS_MIPMAP 0x00400000
64 #define DDSCAPS_TEXTURE 0x00001000
66 #define DDSCAPS2_CUBEMAP 0x00000200
67 #define DDSCAPS2_VOLUME 0x00200000
68 #define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
69 #define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
70 #define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
71 #define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
72 #define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
73 #define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
75 #define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX | \
76 DDSCAPS2_CUBEMAP_NEGATIVEX | \
77 DDSCAPS2_CUBEMAP_POSITIVEY | \
78 DDSCAPS2_CUBEMAP_NEGATIVEY | \
79 DDSCAPS2_CUBEMAP_POSITIVEZ | \
80 DDSCAPS2_CUBEMAP_NEGATIVEZ )
136 #define DDS_OFFSET 4+sizeof(DDSURFACEDESC2) //place where the data starts -- should be 128
int Texture_compression_available
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data=NULL, int cubemap=0, const char *filename=NULL)
int dds_read_header(const char *filename, CFILE *img_cfp=NULL, int *width=0, int *height=0, int *bpp=0, int *compression_type=0, int *levels=0, int *size=0, ubyte *palette=NULL)
int dds_read_bitmap(const char *filename, ubyte *data, ubyte *bpp=NULL, int cf_type=CF_TYPE_ANY)
int Use_compressed_textures
const char * dds_error_string(int code)
struct _DDSURFACEDESC2 DDSURFACEDESC2
GLint GLsizei GLsizei height
struct _DDSURFACEDESC2::@14 ddsCaps
struct _DDSURFACEDESC2::@13 ddpfPixelFormat
GLenum GLsizei GLenum GLenum const GLvoid * data