]> git.mxchange.org Git - simgear.git/blobdiff - simgear/screen/extensions.hxx
Add a function to calculate the normalmap from a regular texture.
[simgear.git] / simgear / screen / extensions.hxx
index bc3219ac8d9daaa37b3f0cd3268579d82dfd032d..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,19 +72,32 @@ 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
 }
 
+/*
+ * OpenGL 1.2 and 1.3 enumerants
+ */
+
+#ifndef GL_VERSION_1_2
+#define GL_CLAMP_TO_EDGE                                        0x812F
+#define GL_TEXTURE_WRAP_R                                       0x8072
+#define GL_BLEND_EQUATION                                       0x8009
+#define GL_MIN                                                  0x8007
+#define GL_MAX                                                  0x8008
+#define GL_FUNC_ADD                                             0x8006
+#define GL_FUNC_SUBTRACT                                        0x800A
+#define GL_FUNC_REVERSE_SUBTRACT                                0x800B
+#define GL_BLEND_COLOR                                          0x8005
+#define GL_CONSTANT_COLOR                                       0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR                             0x8002
+#define GL_CONSTANT_ALPHA                                       0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA                             0x8004
+#endif
+
+typedef void (APIENTRY * glBlendEquationProc) (GLenum mode );
+typedef void (APIENTRY * glBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
 
 
 /* OpenGL extension declarations */
@@ -144,6 +164,7 @@ typedef void (APIENTRY * glPointParameterfvProc)(GLenum pname, const GLfloat *pa
 #endif
 
 typedef void (APIENTRY * glActiveTextureProc)(GLenum texture);
+typedef void (APIENTRY * glClientActiveTextureProc)(GLenum texture);
 
 /*
  * GL_EXT_separate_specular_color
@@ -155,6 +176,65 @@ typedef void (APIENTRY * glActiveTextureProc)(GLenum texture);
 #define GL_SEPARATE_SPECULAR_COLOR                              0x81FA
 #endif
 
+/*
+ * GL_ARB_texture_cube_map
+ */
+
+#ifndef GL_ARB_texture_cube_map
+#define GL_ARB_texture_cube_map 1
+#define GL_NORMAL_MAP_ARB                                       0x8511
+#define GL_REFLECTION_MAP_ARB                                   0x8512
+#define GL_TEXTURE_CUBE_MAP_ARB                                 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARB                         0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB                      0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB                      0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB                      0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB                      0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB                      0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB                      0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARB                           0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB                        0x851C
+#endif
+
+/*
+ * GL_ARB_texture_env_combine
+ */
+
+#ifndef GL_ARB_texture_env_combine
+#define GL_ARB_texture_env_combine 1
+#define GL_COMBINE_ARB                                          0x8570
+#define GL_COMBINE_RGB_ARB                                      0x8571
+#define GL_COMBINE_ALPHA_ARB                                    0x8572
+#define GL_RGB_SCALE_ARB                                        0x8573
+#define GL_ADD_SIGNED_ARB                                       0x8574
+#define GL_INTERPOLATE_ARB                                      0x8575
+#define GL_CONSTANT_ARB                                         0x8576
+#define GL_PRIMARY_COLOR_ARB                                    0x8577
+#define GL_PREVIOUS_ARB                                         0x8578
+#define GL_SOURCE0_RGB_ARB                                      0x8580
+#define GL_SOURCE1_RGB_ARB                                      0x8581
+#define GL_SOURCE2_RGB_ARB                                      0x8582
+#define GL_SOURCE0_ALPHA_ARB                                    0x8588
+#define GL_SOURCE1_ALPHA_ARB                                    0x8589
+#define GL_SOURCE2_ALPHA_ARB                                    0x858A
+#define GL_OPERAND0_RGB_ARB                                     0x8590
+#define GL_OPERAND1_RGB_ARB                                     0x8591
+#define GL_OPERAND2_RGB_ARB                                     0x8592
+#define GL_OPERAND0_ALPHA_ARB                                   0x8598
+#define GL_OPERAND1_ALPHA_ARB                                   0x8599
+#define GL_OPERAND2_ALPHA_ARB                                   0x859A
+#endif
+
+/*
+ * GL_ARB_texture_env_dot3
+ */
+
+#ifndef GL_ARB_texture_env_dot3
+#define GL_ARB_texture_env_dot3 1
+#define GL_DOT3_RGB_ARB                                         0x86AE
+#define GL_DOT3_RGBA_ARB                                        0x86AF
+#endif
+
 #if defined(__cplusplus)
 }
 #endif