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