]> git.mxchange.org Git - simgear.git/blob - simgear/screen/extensions.hxx
Oops, one addtional tweak.
[simgear.git] / simgear / screen / extensions.hxx
1 /*
2  *
3  * Copyright (c) 2001 César Blecua Udías    All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * CESAR BLECUA UDIAS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  */
24 #ifndef __SG_EXTENSIONS_HXX
25 #define __SG_EXTENSIONS_HXX 1
26
27 #if defined(__CYGWIN__)  /* && !defined(USING_X) */
28 #define WIN32
29 #endif
30
31 #if defined(WIN32)  /* MINGW and MSC predefine WIN32 */
32 # include <windows.h>
33 #endif
34
35 #if !defined(WIN32)
36 # include <dlfcn.h>
37 #endif
38
39 #include <GL/gl.h>
40
41
42 #if defined(__cplusplus)
43 extern "C" {
44 #endif
45
46 #ifndef APIENTRY
47 #define APIENTRY
48 #endif
49
50     // static bool SGSearchExtensionsString(char *extString, char *extName);
51 bool SGIsOpenGLExtensionSupported(char *extName);
52
53 #ifdef __APPLE__
54   // don't use an inline function for symbol lookup, since it is too big
55   void* macosxGetGLProcAddress(const char *func);
56 #endif
57
58 inline void (*SGLookupFunction(const char *func))()
59 {
60 #if defined( WIN32 )
61     return (void (*)()) wglGetProcAddress(func);
62
63 #elif defined( __APPLE__ )
64     return (void (*)()) macosxGetGLProcAddress(func);
65
66 #else // UNIX
67
68     // If the target system s UNIX and the ARB_get_proc_address
69     // GLX extension is *not* guaranteed to be supported. An alternative
70     // dlsym-based approach will be used instead.
71
72     void *libHandle;
73     void (*fptr)();
74     libHandle = dlopen("libGL.so", RTLD_LAZY);
75     fptr = (void (*)()) dlsym(libHandle, func);
76     dlclose(libHandle);
77     return fptr;
78 #endif
79 }
80
81
82
83 /* OpenGL extension declarations */
84
85 /*
86  * glPointParameterf and glPointParameterfv
87  */
88 #ifndef GL_EXT_point_parameters
89 #define GL_EXT_point_parameters 1
90 #define GL_POINT_SIZE_MIN_EXT                                   0x8126
91 #define GL_DISTANCE_ATTENUATION_EXT                             0x8129
92 #endif
93
94 #ifndef GL_ARB_point_parameters
95 #define GL_ARB_point_parameters 1
96 #define GL_POINT_SIZE_MIN_ARB                                   0x8126
97 #define GL_DISTANCE_ATTENUATION_ARB                             0x8129
98 #endif
99
100 typedef void (APIENTRY * glPointParameterfProc)(GLenum pname, GLfloat param);
101 typedef void (APIENTRY * glPointParameterfvProc)(GLenum pname, const GLfloat *params);
102
103 /*
104  * glActiveTextureARB
105  */
106
107 #ifndef GL_ARB_multitexture
108 #define GL_ARB_multitexture 1
109 #define GL_TEXTURE0_ARB                                         0x84C0
110 #define GL_TEXTURE1_ARB                                         0x84C1
111 #define GL_TEXTURE2_ARB                                         0x84C2
112 #define GL_TEXTURE3_ARB                                         0x84C3
113 #define GL_TEXTURE4_ARB                                         0x84C4
114 #define GL_TEXTURE5_ARB                                         0x84C5
115 #define GL_TEXTURE6_ARB                                         0x84C6
116 #define GL_TEXTURE7_ARB                                         0x84C7
117 #define GL_TEXTURE8_ARB                                         0x84C8
118 #define GL_TEXTURE9_ARB                                         0x84C9
119 #define GL_TEXTURE10_ARB                                        0x84CA
120 #define GL_TEXTURE11_ARB                                        0x84CB
121 #define GL_TEXTURE12_ARB                                        0x84CC
122 #define GL_TEXTURE13_ARB                                        0x84CD
123 #define GL_TEXTURE14_ARB                                        0x84CE
124 #define GL_TEXTURE15_ARB                                        0x84CF
125 #define GL_TEXTURE16_ARB                                        0x84D0
126 #define GL_TEXTURE17_ARB                                        0x84D1
127 #define GL_TEXTURE18_ARB                                        0x84D2
128 #define GL_TEXTURE19_ARB                                        0x84D3
129 #define GL_TEXTURE20_ARB                                        0x84D4
130 #define GL_TEXTURE21_ARB                                        0x84D5
131 #define GL_TEXTURE22_ARB                                        0x84D6
132 #define GL_TEXTURE23_ARB                                        0x84D7
133 #define GL_TEXTURE24_ARB                                        0x84D8
134 #define GL_TEXTURE25_ARB                                        0x84D9
135 #define GL_TEXTURE26_ARB                                        0x84DA
136 #define GL_TEXTURE27_ARB                                        0x84DB
137 #define GL_TEXTURE28_ARB                                        0x84DC
138 #define GL_TEXTURE29_ARB                                        0x84DD
139 #define GL_TEXTURE30_ARB                                        0x84DE
140 #define GL_TEXTURE31_ARB                                        0x84DF
141 #define GL_ACTIVE_TEXTURE_ARB                                   0x84E0
142 #define GL_CLIENT_ACTIVE_TEXTURE_ARB                            0x84E1
143 #define GL_MAX_TEXTURE_UNITS_ARB                                0x84E2
144 #endif
145
146 typedef void (APIENTRY * glActiveTextureProc)(GLenum texture);
147
148 /*
149  * GL_EXT_separate_specular_color
150  */
151
152 #ifndef GL_LIGHT_MODEL_COLOR_CONTROL
153 #define GL_LIGHT_MODEL_COLOR_CONTROL                            0x81F8
154 #define GL_SINGLE_COLOR                                         0x81F9
155 #define GL_SEPARATE_SPECULAR_COLOR                              0x81FA
156 #endif
157
158 #if defined(__cplusplus)
159 }
160 #endif
161
162 #endif // !__SG_EXTENSIONS_HXX
163