From 904cce6311f8a0790672a79a877dce478033708a Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Wed, 5 Sep 2007 18:56:39 +0000 Subject: [PATCH] * Replace the ugliness in qgl.h with SDL_opengl.h --- code/jpeg-6/jconfig.h | 1 - code/renderer/qgl.h | 123 +++--------------------------------------- code/sdl/sdl_glimp.c | 12 ++--- 3 files changed, 12 insertions(+), 124 deletions(-) diff --git a/code/jpeg-6/jconfig.h b/code/jpeg-6/jconfig.h index 7d2f733b..361586ee 100644 --- a/code/jpeg-6/jconfig.h +++ b/code/jpeg-6/jconfig.h @@ -8,7 +8,6 @@ /* #define const */ #define CHAR_IS_UNSIGNED #define HAVE_STDDEF_H -#define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS /* Watcom uses flat 32-bit addressing */ diff --git a/code/renderer/qgl.h b/code/renderer/qgl.h index 2dc6b35a..a2ed1234 100644 --- a/code/renderer/qgl.h +++ b/code/renderer/qgl.h @@ -26,125 +26,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifndef __QGL_H__ #define __QGL_H__ -#if defined( _WIN32 ) +#include "SDL_opengl.h" -#if _MSC_VER -#pragma warning (disable: 4201) -#pragma warning (disable: 4214) -#pragma warning (disable: 4514) -#pragma warning (disable: 4032) -#pragma warning (disable: 4201) -#pragma warning (disable: 4214) -#endif +extern PFNGLMULTITEXCOORD2FARBPROC qglMultiTexCoord2fARB; +extern PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB; +extern PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB; -#include -#include -#include - -#elif defined(MACOS_X) - -#include -#include -#include -#ifndef GL_EXT_abgr -#include -#endif - -#else - -#include -#include - -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif - - -//=========================================================================== -// I hate this section so much - -/* -** multitexture extension definitions -*/ -#if !defined(__sun) - -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_ACTIVE_TEXTURES_ARB 0x84E2 - -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 - -#else - -// FIXME GL_MAX_TEXTURE_UNITS_ARB? -#define GL_MAX_ACTIVE_TEXTURES_ARB 0x84E2 - -#endif /* defined(__sun) */ - -// anisotropic filtering constants -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF - -// define for skyboxes without black seams on non SDL-versions. -#if !defined(GL_VERSION_1_2) && !defined(GL_CLAMP_TO_EDGE) - #define GL_CLAMP_TO_EDGE 0x812F -#endif - -// S3TC compression constants -#define GL_RGB_S3TC 0x83A0 -#define GL_RGB4_S3TC 0x83A1 - -#if defined(MACOS_X) || ( defined(__sun) && defined(__sparc) ) -typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); -typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); -typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); -typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); -typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target); -typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum target); -#endif - -//=========================================================================== - -// extensions will be function pointers on all platforms -extern void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t ); -extern void ( APIENTRY * qglActiveTextureARB )( GLenum texture ); -extern void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture ); - -extern void ( APIENTRY * qglLockArraysEXT)( GLint, GLint); -extern void ( APIENTRY * qglUnlockArraysEXT) ( void ); +extern PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT; +extern PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT; //=========================================================================== diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index b32dac1e..cb9a70e1 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -62,12 +62,12 @@ static SDL_Surface *screen = NULL; cvar_t *r_allowSoftwareGL; // Don't abort out if a hardware visual can't be obtained -void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t ); -void ( APIENTRY * qglActiveTextureARB )( GLenum texture ); -void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture ); +PFNGLMULTITEXCOORD2FARBPROC qglMultiTexCoord2fARB; +PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB; +PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB; -void ( APIENTRY * qglLockArraysEXT)( GLint, GLint); -void ( APIENTRY * qglUnlockArraysEXT) ( void ); +PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT; +PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT; /* =============== @@ -387,7 +387,7 @@ static void GLimp_InitExtensions( void ) if ( qglActiveTextureARB ) { GLint glint = 0; - qglGetIntegerv( GL_MAX_ACTIVE_TEXTURES_ARB, &glint ); + qglGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &glint ); glConfig.maxActiveTextures = (int) glint; if ( glConfig.maxActiveTextures > 1 ) {