diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dds.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -5,8 +5,11 @@ #include <GL/gl.h> #include <GL/glu.h> #include <GL/glext.h> // Your local header file +#ifdef USE_OSMESA +#include <GL/osmesa.h> +#endif -//PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB; +PFNGLCOMPRESSEDTEXIMAGE2DARBPROC l_glCompressedTexImage2DARB; #define MAKEFOURCC(ch0, ch1, ch2, ch3) \ ((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \ @@ -279,7 +282,7 @@ int loadCompressedTexture( DDS_IMAGE_DATA *pDDSImageData ) nSize = ((nWidth+3)/4) * ((nHeight+3)/4) * nBlockSize; - glCompressedTexImage2DARB( GL_TEXTURE_2D, + l_glCompressedTexImage2DARB( GL_TEXTURE_2D, i, pDDSImageData->format, nWidth, @@ -310,14 +313,18 @@ int ddsInit() { } else { -// glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)glxGetProcAddress("glCompressedTexImage2DARB"); +#ifdef USE_OSMESA + l_glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)OSMesaGetProcAddress("glCompressedTexImage2DARB"); +#else + l_glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)glxGetProcAddress("glCompressedTexImage2DARB"); +#endif -// if( !glCompressedTexImage2DARB ) -// { + if( !l_glCompressedTexImage2DARB ) + { // MessageBox(NULL,"One or more ARB_texture_compression functions were not found", // "ERROR",MB_OK|MB_ICONEXCLAMATION); -// return -2; -// } + return -2; + } } return 0; |