#ifndef _GLTOOLS_H_ #define _GLTOOLS_H_ /* this is the targa header, pragmas are needed to do the voodoo magic */ /* http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/ */ #pragma pack(1) typedef struct { GLbyte identsize; /* Size of id field that follows header (0) */ GLbyte imageType; /* 0 = none, 1 = indexed, 2 = rgb, 3 = grey, +8 = rle */ GLbyte colorMapType; /* 0 = none, 1 = paletted */ unsigned short colorMapStart; /* first colour map entry */ unsigned short colorMapLength; /* number of colors */ unsigned char colorMapBits; /* bits per palette entry */ unsigned short xstart; /* image x origin */ unsigned short ystart; /* image y origin */ unsigned short width; /* width in pixels */ unsigned short height; /* height in pixels */ GLbyte bits; /* bits per pixel (8 16, 24, 32) */ GLbyte descriptor; /* image descriptor */ } TGAHEADER; #pragma pack() /* function prototypes */ GLuint gltLoadTGATexture(const char *); void gltListExtensions(void); void gltOpenGLInfo(void); GLboolean gltQueryExtension(const char *); GLint gltWriteTGA(const char *); GLbyte *gltLoadTGA(const char *, GLint *, GLint *, GLint *, GLenum *); #ifdef _WIN32 char *strsep(char**, const char*); #endif static inline void gltErrorCheck(void) { GLenum err_code; const GLubyte *err_str; while ((err_code = glGetError()) != GL_NO_ERROR) { err_str = gluErrorString(err_code); fprintf(stderr, "OpenGL error: %s\n", err_str); } } #endif