X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fqgl.cpp;h=d64b7a5fe2f37e3b95c768ef0ab83535eb0ae982;hb=d052c83e50a258421e1f51ac99b135b403c18989;hp=a352b8d0723cde907f5a69bf0914deb25e31fcc3;hpb=c001d05fb1dc902a725dbf50df82e88a1a526a21;p=xonotic%2Fnetradiant.git diff --git a/radiant/qgl.cpp b/radiant/qgl.cpp index a352b8d0..d64b7a5f 100644 --- a/radiant/qgl.cpp +++ b/radiant/qgl.cpp @@ -21,6 +21,7 @@ #include "qgl.h" +#include "globaldefs.h" #include "debugging/debugging.h" @@ -28,18 +29,18 @@ #include #include -#if defined( _WIN32 ) +#if GDEF_OS_WINDOWS #define WINGDIAPI __declspec( dllimport ) #define APIENTRY __stdcall #endif -#if defined( __APPLE__ ) && !defined( XWINDOWS ) +#if GDEF_OS_MACOS && !defined( XWINDOWS ) #include #else #include #endif -#if defined( _WIN32 ) +#if GDEF_OS_WINDOWS #undef WINGDIAPI #undef APIENTRY #endif @@ -49,7 +50,7 @@ -#if defined( _WIN32 ) +#if GDEF_OS_WINDOWS #include @@ -64,7 +65,7 @@ Bool ( *qglXQueryExtension )( Display *dpy, int *errorb, int *event ); void* ( *qglXGetProcAddressARB )( const GLubyte * procName ); typedef void* ( *glXGetProcAddressARBProc )( const GLubyte *procName ); -#elif defined(__APPLE__) +#elif GDEF_OS_MACOS #include #include #include @@ -76,12 +77,12 @@ typedef void* ( *glXGetProcAddressARBProc )( const GLubyte *procName ); void QGL_Shutdown( OpenGLBinding& table ){ globalOutputStream() << "Shutting down OpenGL module..."; -#if defined( WIN32 ) +#if GDEF_OS_WINDOWS qwglGetProcAddress = 0; #elif defined( XWINDOWS ) qglXQueryExtension = glXQueryExtension; qglXGetProcAddressARB = 0; -#elif defined(__APPLE__) +#elif GDEF_OS_MACOS #else #error "unsupported platform" #endif @@ -138,7 +139,7 @@ bool QGL_ExtensionSupported( const char* extension ){ } extensions = GlobalOpenGL().m_glGetString( GL_EXTENSIONS ); -#ifndef __APPLE__ +#if !GDEF_OS_MACOS if ( !extensions ) { return false; } @@ -179,7 +180,7 @@ QGLFunctionPointer QGL_getExtensionFunc( const char* symbol ){ { return (QGLFunctionPointer) qglXGetProcAddressARB( reinterpret_cast( symbol ) ); } -#elif defined(__APPLE__) +#elif GDEF_OS_MACOS // Prepend a '_' for the Unix C symbol mangling convention char *symbolName = (char *) malloc(strlen(symbol) + 2); strcpy(symbolName + 1, symbol); @@ -188,7 +189,7 @@ QGLFunctionPointer QGL_getExtensionFunc( const char* symbol ){ if (NSIsSymbolNameDefined(symbolName)) nssymbol = NSLookupAndBindSymbol(symbolName); free(symbolName); return nssymbol ? reinterpret_cast(NSAddressOfSymbol(nssymbol)) : reinterpret_cast(glInvalidFunction); -#elif defined( WIN32 ) +#elif GDEF_OS_WINDOWS ASSERT_NOTNULL( qwglGetProcAddress ); return (QGLFunctionPointer) qwglGetProcAddress( symbol ); #else @@ -550,14 +551,14 @@ void QGL_clear( OpenGLBinding& table ){ int QGL_Init( OpenGLBinding& table ){ QGL_clear( table ); -#if defined( WIN32 ) +#if GDEF_OS_WINDOWS qwglGetProcAddress = wglGetProcAddress; #elif defined( XWINDOWS ) qglXGetProcAddressARB = (glXGetProcAddressARBProc)dlsym( RTLD_DEFAULT, "glXGetProcAddressARB" ); if ( ( qglXQueryExtension == 0 ) || ( qglXQueryExtension(XOpenDisplay(nullptr), 0, 0) != True ) ) { return 0; } -#elif defined (__APPLE__) +#elif GDEF_OS_MACOS #else #error "unsupported platform" #endif