#ifndef __SG_EXTENSIONS_HXX
#define __SG_EXTENSIONS_HXX 1
-#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#if defined(__CYGWIN__) && !defined(WIN32) /* && !defined(USING_X) */
+#define WIN32
+#endif
+
+#if defined(WIN32) /* MINGW and MSC predefine WIN32 */
# include <windows.h>
-#else
+#endif
+
+#if !defined(WIN32)
# include <dlfcn.h>
#endif
-#include <GL/gl.h>
+#include <simgear/compiler.h>
+
+#include SG_GL_H
#if defined(__cplusplus)
#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))()
{
-#if defined( WIN32 ) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#if defined( WIN32 )
return (void (*)()) wglGetProcAddress(func);
#elif defined( __APPLE__ )
#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 */
#endif
typedef void (APIENTRY * glActiveTextureProc)(GLenum texture);
+typedef void (APIENTRY * glClientActiveTextureProc)(GLenum texture);
+
+/*
+ * GL_EXT_separate_specular_color
+ */
+
+#ifndef GL_LIGHT_MODEL_COLOR_CONTROL
+#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
+#define GL_SINGLE_COLOR 0x81F9
+#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)
}