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