]> git.mxchange.org Git - simgear.git/blob - simgear/screen/extensions.hxx
Work around a broken dlopen/dlclose Linux implementation.
[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
57 #else if !defined( WIN32 )
58
59   void *SGGetGLProcAddress(const char *func);
60   
61 #endif
62
63 inline void (*SGLookupFunction(const char *func))()
64 {
65 #if defined( WIN32 )
66     return (void (*)()) wglGetProcAddress(func);
67
68 #elif defined( __APPLE__ )
69     return (void (*)()) macosxGetGLProcAddress(func);
70
71 #else // UNIX
72
73     return (void (*)()) SGGetGLProcAddress(func);
74 #endif
75 }
76
77 /*
78  * OpenGL 1.2 and 1.3 enumerants
79  */
80
81 #ifndef GL_VERSION_1_2
82 #define GL_CLAMP_TO_EDGE                                        0x812F
83 #define GL_TEXTURE_WRAP_R                                       0x8072
84 #define GL_BLEND_EQUATION                                       0x8009
85 #define GL_MIN                                                  0x8007
86 #define GL_MAX                                                  0x8008
87 #define GL_FUNC_ADD                                             0x8006
88 #define GL_FUNC_SUBTRACT                                        0x800A
89 #define GL_FUNC_REVERSE_SUBTRACT                                0x800B
90 #define GL_BLEND_COLOR                                          0x8005
91 #define GL_CONSTANT_COLOR                                       0x8001
92 #define GL_ONE_MINUS_CONSTANT_COLOR                             0x8002
93 #define GL_CONSTANT_ALPHA                                       0x8003
94 #define GL_ONE_MINUS_CONSTANT_ALPHA                             0x8004
95 #endif
96
97 typedef void (APIENTRY * glBlendEquationProc) (GLenum mode );
98 typedef void (APIENTRY * glBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
99
100
101 /* OpenGL extension declarations */
102
103 /*
104  * glPointParameterf and glPointParameterfv
105  */
106 #ifndef GL_EXT_point_parameters
107 #define GL_EXT_point_parameters 1
108 #define GL_POINT_SIZE_MIN_EXT                                   0x8126
109 #define GL_DISTANCE_ATTENUATION_EXT                             0x8129
110 #endif
111
112 #ifndef GL_ARB_point_parameters
113 #define GL_ARB_point_parameters 1
114 #define GL_POINT_SIZE_MIN_ARB                                   0x8126
115 #define GL_DISTANCE_ATTENUATION_ARB                             0x8129
116 #endif
117
118 typedef void (APIENTRY * glPointParameterfProc)(GLenum pname, GLfloat param);
119 typedef void (APIENTRY * glPointParameterfvProc)(GLenum pname, const GLfloat *params);
120
121 /*
122  * glActiveTextureARB
123  */
124
125 #ifndef GL_ARB_multitexture
126 #define GL_ARB_multitexture 1
127 #define GL_TEXTURE0_ARB                                         0x84C0
128 #define GL_TEXTURE1_ARB                                         0x84C1
129 #define GL_TEXTURE2_ARB                                         0x84C2
130 #define GL_TEXTURE3_ARB                                         0x84C3
131 #define GL_TEXTURE4_ARB                                         0x84C4
132 #define GL_TEXTURE5_ARB                                         0x84C5
133 #define GL_TEXTURE6_ARB                                         0x84C6
134 #define GL_TEXTURE7_ARB                                         0x84C7
135 #define GL_TEXTURE8_ARB                                         0x84C8
136 #define GL_TEXTURE9_ARB                                         0x84C9
137 #define GL_TEXTURE10_ARB                                        0x84CA
138 #define GL_TEXTURE11_ARB                                        0x84CB
139 #define GL_TEXTURE12_ARB                                        0x84CC
140 #define GL_TEXTURE13_ARB                                        0x84CD
141 #define GL_TEXTURE14_ARB                                        0x84CE
142 #define GL_TEXTURE15_ARB                                        0x84CF
143 #define GL_TEXTURE16_ARB                                        0x84D0
144 #define GL_TEXTURE17_ARB                                        0x84D1
145 #define GL_TEXTURE18_ARB                                        0x84D2
146 #define GL_TEXTURE19_ARB                                        0x84D3
147 #define GL_TEXTURE20_ARB                                        0x84D4
148 #define GL_TEXTURE21_ARB                                        0x84D5
149 #define GL_TEXTURE22_ARB                                        0x84D6
150 #define GL_TEXTURE23_ARB                                        0x84D7
151 #define GL_TEXTURE24_ARB                                        0x84D8
152 #define GL_TEXTURE25_ARB                                        0x84D9
153 #define GL_TEXTURE26_ARB                                        0x84DA
154 #define GL_TEXTURE27_ARB                                        0x84DB
155 #define GL_TEXTURE28_ARB                                        0x84DC
156 #define GL_TEXTURE29_ARB                                        0x84DD
157 #define GL_TEXTURE30_ARB                                        0x84DE
158 #define GL_TEXTURE31_ARB                                        0x84DF
159 #define GL_ACTIVE_TEXTURE_ARB                                   0x84E0
160 #define GL_CLIENT_ACTIVE_TEXTURE_ARB                            0x84E1
161 #define GL_MAX_TEXTURE_UNITS_ARB                                0x84E2
162 #endif
163
164 typedef void (APIENTRY * glActiveTextureProc)(GLenum texture);
165 typedef void (APIENTRY * glClientActiveTextureProc)(GLenum texture);
166
167 /*
168  * GL_EXT_separate_specular_color
169  */
170
171 #ifndef GL_LIGHT_MODEL_COLOR_CONTROL
172 #define GL_LIGHT_MODEL_COLOR_CONTROL                            0x81F8
173 #define GL_SINGLE_COLOR                                         0x81F9
174 #define GL_SEPARATE_SPECULAR_COLOR                              0x81FA
175 #endif
176
177 /*
178  * GL_ARB_texture_cube_map
179  */
180
181 #ifndef GL_ARB_texture_cube_map
182 #define GL_ARB_texture_cube_map 1
183 #define GL_NORMAL_MAP_ARB                                       0x8511
184 #define GL_REFLECTION_MAP_ARB                                   0x8512
185 #define GL_TEXTURE_CUBE_MAP_ARB                                 0x8513
186 #define GL_TEXTURE_BINDING_CUBE_MAP_ARB                         0x8514
187 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB                      0x8515
188 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB                      0x8516
189 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB                      0x8517
190 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB                      0x8518
191 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB                      0x8519
192 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB                      0x851A
193 #define GL_PROXY_TEXTURE_CUBE_MAP_ARB                           0x851B
194 #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB                        0x851C
195 #endif
196
197 /*
198  * GL_ARB_texture_env_combine
199  */
200
201 #ifndef GL_ARB_texture_env_combine
202 #define GL_ARB_texture_env_combine 1
203 #define GL_COMBINE_ARB                                          0x8570
204 #define GL_COMBINE_RGB_ARB                                      0x8571
205 #define GL_COMBINE_ALPHA_ARB                                    0x8572
206 #define GL_RGB_SCALE_ARB                                        0x8573
207 #define GL_ADD_SIGNED_ARB                                       0x8574
208 #define GL_INTERPOLATE_ARB                                      0x8575
209 #define GL_CONSTANT_ARB                                         0x8576
210 #define GL_PRIMARY_COLOR_ARB                                    0x8577
211 #define GL_PREVIOUS_ARB                                         0x8578
212 #define GL_SOURCE0_RGB_ARB                                      0x8580
213 #define GL_SOURCE1_RGB_ARB                                      0x8581
214 #define GL_SOURCE2_RGB_ARB                                      0x8582
215 #define GL_SOURCE0_ALPHA_ARB                                    0x8588
216 #define GL_SOURCE1_ALPHA_ARB                                    0x8589
217 #define GL_SOURCE2_ALPHA_ARB                                    0x858A
218 #define GL_OPERAND0_RGB_ARB                                     0x8590
219 #define GL_OPERAND1_RGB_ARB                                     0x8591
220 #define GL_OPERAND2_RGB_ARB                                     0x8592
221 #define GL_OPERAND0_ALPHA_ARB                                   0x8598
222 #define GL_OPERAND1_ALPHA_ARB                                   0x8599
223 #define GL_OPERAND2_ALPHA_ARB                                   0x859A
224 #endif
225
226 /*
227  * GL_ARB_texture_env_dot3
228  */
229
230 #ifndef GL_ARB_texture_env_dot3
231 #define GL_ARB_texture_env_dot3 1
232 #define GL_DOT3_RGB_ARB                                         0x86AE
233 #define GL_DOT3_RGBA_ARB                                        0x86AF
234 #endif
235
236 #if defined(__cplusplus)
237 }
238 #endif
239
240 #endif // !__SG_EXTENSIONS_HXX
241