]> git.mxchange.org Git - simgear.git/blobdiff - simgear/screen/extensions.hxx
cygwin and mingw fixes
[simgear.git] / simgear / screen / extensions.hxx
index 949345a82f729ed7805c7ba3d57749fd42ecc7d6..a15a475989d585fe21350da0614a58f4378232f8 100644 (file)
@@ -1,21 +1,67 @@
+/*
+ *
+ * Copyright (c) 2001 César Blecua Udías    All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CESAR BLECUA UDIAS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
 #ifndef __SG_EXTENSIONS_HXX
 #define __SG_EXTENSIONS_HXX 1
 
-#ifndef WIN32
-#include <dlfcn.h>
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+# include <windows.h>
+#else
+# include <dlfcn.h>
+#endif
+
+#include <GL/gl.h>
+
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+static bool SGSearchExtensionsString(char *extString, char *extName);
+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);
 #endif
 
 inline void (*SGLookupFunction(const char *func))() {
 
-#if defined( WIN32 )
+#if defined( WIN32 ) && !defined(__CYGWIN__) && !defined(__MINGW32__)
         return (void (*)()) wglGetProcAddress(func);
 
+#elif defined( __APPLE__ )
+       return (void (*)()) macosxGetGLProcAddress(func);
 #else
 
   // 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.
-  #if defined( linux ) || defined ( sgi )
+  #if defined( linux ) || defined ( sgi ) || defined(__CYGWIN__) || defined(__MINGW32__)
         void *libHandle;
         void (*fptr)();
         libHandle = dlopen("libGL.so", RTLD_LAZY);
@@ -28,4 +74,25 @@ inline void (*SGLookupFunction(const char *func))() {
 #endif
 }
 
+
+
+/* OpenGL extension declarations */
+#ifndef GL_EXT_point_parameters
+#define GL_POINT_SIZE_MIN_EXT                                   0x8126
+#define GL_DISTANCE_ATTENUATION_EXT                             0x8129
+#endif
+
+#ifndef GL_ARB_point_parameters
+#define GL_POINT_SIZE_MIN_ARB                                  0x8126
+#define GL_DISTANCE_ATTENUATION_ARB                            0x8129
+#endif
+
+typedef void (APIENTRY * glPointParameterfProc)(GLenum pname, GLfloat param);
+typedef void (APIENTRY * glPointParameterfvProc)(GLenum pname, const GLfloat *params);
+
+#if defined(__cplusplus)
+}
 #endif
+
+#endif // !__SG_EXTENSIONS_HXX
+