]> git.mxchange.org Git - simgear.git/blobdiff - simgear/screen/extensions.hxx
Frederic Bouvier:
[simgear.git] / simgear / screen / extensions.hxx
index 26eb3d9d5adeddf0f8ecbef4cec780b40574b2d3..4b9046a0c1e6316996d260cef51190924b5670de 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __SG_EXTENSIONS_HXX
 #define __SG_EXTENSIONS_HXX 1
 
-#if defined(__CYGWIN__)  /* && !defined(USING_X) */
+#if defined(__CYGWIN__) && !defined(WIN32) /* && !defined(USING_X) */
 #define WIN32
 #endif
 
@@ -36,7 +36,9 @@
 # include <dlfcn.h>
 #endif
 
-#include <GL/gl.h>
+#include <simgear/compiler.h>
+
+#include SG_GL_H
 
 
 #if defined(__cplusplus)
@@ -53,6 +55,11 @@ bool SGIsOpenGLExtensionSupported(char *extName);
 #ifdef __APPLE__
   // don't use an inline function for symbol lookup, since it is too big
   void* macosxGetGLProcAddress(const char *func);
+
+#elif !defined( WIN32 )
+
+  void *SGGetGLProcAddress(const char *func);
+  
 #endif
 
 inline void (*SGLookupFunction(const char *func))()
@@ -65,16 +72,7 @@ inline void (*SGLookupFunction(const char *func))()
 
 #else // UNIX
 
-    // If the target system s UNIX and the ARB_get_proc_address
-    // GLX extension is *not* guaranteed to be supported. An alternative
-    // dlsym-based approach will be used instead.
-
-    void *libHandle;
-    void (*fptr)();
-    libHandle = dlopen("libGL.so", RTLD_LAZY);
-    fptr = (void (*)()) dlsym(libHandle, func);
-    dlclose(libHandle);
-    return fptr;
+    return (void (*)()) SGGetGLProcAddress(func);
 #endif
 }