1 #ifndef COIN_GLUE_GLP_H
2 #define COIN_GLUE_GLP_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #ifndef COIN_INTERNAL
37 #error this is a private header file
38 #endif /* ! COIN_INTERNAL */
39 
40 #ifdef HAVE_CONFIG_H
41 #include <config.h>
42 #endif /* HAVE_CONFIG_H */
43 
44 /* ********************************************************************** */
45 
46 #include <Inventor/system/gl.h>
47 #include "base/dict.h"
48 #include <Inventor/C/base/string.h>
49 #include <Inventor/C/glue/dl.h>
50 
51 /* ********************************************************************** */
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif /* __cplusplus */
56 
57 #if 0 /* to get proper auto-indentation in emacs */
58 }
59 #endif /* emacs indentation */
60 
61 
62 
63 /* Under Win32, we need to make sure we use the correct calling method
64    by using the APIENTRY define for the function signature types (or
65    else we'll get weird stack errors). On other platforms, just define
66    APIENTRY empty. */
67 #ifndef APIENTRY
68 #define APIENTRY
69 #endif /* !APIENTRY */
70 
71 /* Our own typedefs for OpenGL functions. Prefixed with COIN_ to avoid
72    namespace collisions. */
73 typedef void (APIENTRY * COIN_PFNGLTEXIMAGE3DPROC)(GLenum target,
74                                                    GLint level,
75                                                    GLenum internalformat,
76                                                    GLsizei width,
77                                                    GLsizei height,
78                                                    GLsizei depth,
79                                                    GLint border,
80                                                    GLenum format,
81                                                    GLenum type,
82                                                    const GLvoid * pixels);
83 
84 typedef void (APIENTRY * COIN_PFNGLTEXSUBIMAGE3DPROC)(GLenum target,
85                                                       GLint level,
86                                                       GLint xoffset,
87                                                       GLint yoffset,
88                                                       GLint zoffset,
89                                                       GLsizei width,
90                                                       GLsizei height,
91                                                       GLsizei depth,
92                                                       GLenum format,
93                                                       GLenum type,
94                                                       const GLvoid * pixels);
95 
96 typedef void (APIENTRY * COIN_PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target,
97                                                           GLint level,
98                                                           GLint xoffset,
99                                                           GLint yoffset,
100                                                           GLint zoffset,
101                                                           GLint x,
102                                                           GLint y,
103                                                           GLsizei width,
104                                                           GLsizei height);
105 
106 typedef void (APIENTRY * COIN_PFNGLPOLYGONOFFSETPROC)(GLfloat factor,
107                                                       GLfloat bias);
108 
109 typedef void (APIENTRY * COIN_PFNGLBINDTEXTUREPROC)(GLenum target,
110                                                     GLuint texture);
111 
112 typedef void (APIENTRY * COIN_PFNGLDELETETEXTURESPROC)(GLsizei n,
113                                                        const GLuint * textures);
114 
115 typedef void (APIENTRY * COIN_PFNGLGENTEXTURESPROC)(GLsizei n,
116                                                     GLuint *textures);
117 
118 typedef void (APIENTRY * COIN_PFNGLTEXSUBIMAGE2DPROC)(GLenum target,
119                                                       GLint level,
120                                                       GLint xoffset,
121                                                       GLint yoffset,
122                                                       GLsizei width,
123                                                       GLsizei height,
124                                                       GLenum format,
125                                                       GLenum type,
126                                                       const GLvoid * pixels);
127 
128 typedef void (APIENTRY * COIN_PFNGLACTIVETEXTUREPROC)(GLenum texture);
129 typedef void (APIENTRY * COIN_PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture);
130 typedef void (APIENTRY * COIN_PFNGLMULTITEXCOORD2FPROC)(GLenum target,
131                                                         GLfloat s,
132                                                         GLfloat t);
133 typedef void (APIENTRY * COIN_PFNGLMULTITEXCOORD2FVPROC)(GLenum target,
134                                                          const GLfloat * v);
135 typedef void (APIENTRY * COIN_PFNGLMULTITEXCOORD3FVPROC)(GLenum target,
136                                                          const GLfloat * v);
137 typedef void (APIENTRY * COIN_PFNGLMULTITEXCOORD4FVPROC)(GLenum target,
138                                                          const GLfloat * v);
139 
140 typedef void (APIENTRY * COIN_PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask);
141 typedef void (APIENTRY * COIN_PFNGLPOPCLIENTATTRIBPROC)(void);
142 
143 /* typedefs for texture compression */
144 typedef void (APIENTRY * COIN_PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target,
145                                                              GLint level,
146                                                              GLenum internalformat,
147                                                              GLsizei width,
148                                                              GLsizei height,
149                                                              GLsizei depth,
150                                                              GLint border,
151                                                              GLsizei imageSize,
152                                                              const GLvoid * data);
153 typedef void (APIENTRY * COIN_PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target,
154                                                              GLint level,
155                                                              GLenum internalformat,
156                                                              GLsizei width,
157                                                              GLsizei height,
158                                                              GLint border,
159                                                              GLsizei imageSize,
160                                                              const GLvoid * data);
161 typedef void (APIENTRY * COIN_PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target,
162                                                              GLint level,
163                                                              GLenum internalformat,
164                                                              GLsizei width,
165                                                              GLint border,
166                                                              GLsizei imageSize,
167                                                              const GLvoid * data);
168 typedef void (APIENTRY * COIN_PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target,
169                                                                 GLint level,
170                                                                 GLint xoffset,
171                                                                 GLint yoffset,
172                                                                 GLint zoffset,
173                                                                 GLsizei width,
174                                                                 GLsizei height,
175                                                                 GLsizei depth,
176                                                                 GLenum format,
177                                                                 GLsizei imageSize,
178                                                                 const GLvoid * data);
179 typedef void (APIENTRY * COIN_PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target,
180                                                                 GLint level,
181                                                                 GLint xoffset,
182                                                                 GLint yoffset,
183                                                                 GLsizei width,
184                                                                 GLsizei height,
185                                                                 GLenum format,
186                                                                 GLsizei imageSize,
187                                                                 const GLvoid * data);
188 typedef void (APIENTRY * COIN_PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target,
189                                                                 GLint level,
190                                                                 GLint xoffset,
191                                                                 GLsizei width,
192                                                                 GLenum format,
193                                                                 GLsizei imageSize,
194                                                                 const GLvoid *data);
195 typedef void (APIENTRY * COIN_PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target,
196                                                               GLint level,
197                                                               void * img);
198 
199 
200 /* typedefs for palette tetures */
201 typedef void (APIENTRY * COIN_PFNGLCOLORTABLEPROC)(GLenum target,
202                                                    GLenum internalFormat,
203                                                    GLsizei width,
204                                                    GLenum format,
205                                                    GLenum type,
206                                                    const GLvoid * table);
207 typedef void (APIENTRY * COIN_PFNGLCOLORSUBTABLEPROC)(GLenum target,
208                                                       GLsizei start,
209                                                       GLsizei count,
210                                                       GLenum format,
211                                                       GLenum type,
212                                                       const GLvoid * data);
213 typedef void (APIENTRY * COIN_PFNGLGETCOLORTABLEPROC)(GLenum target,
214                                                       GLenum format,
215                                                       GLenum type,
216                                                       GLvoid * data);
217 typedef void (APIENTRY * COIN_PFNGLGETCOLORTABLEPARAMETERIVPROC)(GLenum target,
218                                                                  GLenum pname,
219                                                                  GLint *params);
220 typedef void (APIENTRY * COIN_PFNGLGETCOLORTABLEPARAMETERFVPROC)(GLenum target,
221                                                                  GLenum pname,
222                                                                  GLfloat * params);
223 
224 /* Typedefs for glBlendEquation[EXT]. */
225 typedef void *(APIENTRY * COIN_PFNGLBLENDEQUATIONPROC)(GLenum);
226 
227 /* Typedef for glBlendFuncSeparate */
228 typedef void *(APIENTRY * COIN_PFNGLBLENDFUNCSEPARATEPROC)(GLenum, GLenum, GLenum, GLenum);
229 
230 /* typedefs for OpenGL vertex arrays */
231 typedef void (APIENTRY * COIN_PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
232 typedef void (APIENTRY * COIN_PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
233 typedef void (APIENTRY * COIN_PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const GLvoid *pointer);
234 typedef void (APIENTRY * COIN_PNFGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
235 typedef void (APIENTRY * COIN_PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const GLvoid * pointer);
236 typedef void (APIENTRY * COIN_PFNGLENABLECLIENTSTATEPROC)(GLenum array);
237 typedef void (APIENTRY * COIN_PFNGLDISABLECLIENTSTATEPROC)(GLenum array);
238 typedef void (APIENTRY * COIN_PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const GLvoid * pointer);
239 typedef void (APIENTRY * COIN_PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count);
240 typedef void (APIENTRY * COIN_PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices);
241 typedef void (APIENTRY * COIN_PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices);
242 typedef void (APIENTRY * COIN_PFNGLARRAYELEMENTPROC)(GLint i);
243 
244 typedef void (APIENTRY * COIN_PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint * first,
245                                                         const GLsizei * count, GLsizei primcount);
246 typedef void (APIENTRY * COIN_PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei * count,
247                                                           GLenum type, const GLvoid ** indices, GLsizei primcount);
248 
249 /* Typedefs for NV_vertex_array_range */
250 typedef void (APIENTRY * COIN_PFNGLFLUSHVERTEXARRAYRANGENVPROC)(void);
251 typedef void (APIENTRY * COIN_PFNGLVERTEXARRAYRANGENVPROC)(GLsizei size, const GLvoid * pointer);
252 typedef void * (APIENTRY * COIN_PFNGLALLOCATEMEMORYNVPROC)(GLsizei size, GLfloat readfreq,
253                                                            GLfloat writefreq, GLfloat priority);
254 typedef void (APIENTRY * COIN_PFNGLFREEMEMORYNVPROC)(GLvoid * buffer);
255 
256 
257 /* typedefs for GL_ARB_vertex_buffer_object */
258 typedef void (APIENTRY * COIN_PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer);
259 typedef void (APIENTRY * COIN_PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint * buffers);
260 typedef void (APIENTRY * COIN_PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers);
261 typedef GLboolean (APIENTRY * COIN_PFNGLISBUFFERPROC)(GLuint buffer);
262 typedef void (APIENTRY * COIN_PFNGLBUFFERDATAPROC)(GLenum target,
263                                                    intptr_t size, /* 64 bit on 64 bit systems */
264                                                    const GLvoid *data,
265                                                    GLenum usage);
266 typedef void (APIENTRY * COIN_PFNGLBUFFERSUBDATAPROC)(GLenum target,
267                                                       intptr_t offset, /* 64 bit */
268                                                       intptr_t size, /* 64 bit */
269                                                       const GLvoid * data);
270 typedef void (APIENTRY * COIN_PFNGLGETBUFFERSUBDATAPROC)(GLenum target,
271                                                          intptr_t offset, /* 64 bit */
272                                                          intptr_t size, /* 64 bit */
273                                                          GLvoid *data);
274 typedef GLvoid * (APIENTRY * COIN_PNFGLMAPBUFFERPROC)(GLenum target, GLenum access);
275 typedef GLboolean (APIENTRY * COIN_PFNGLUNMAPBUFFERPROC)(GLenum target);
276 typedef void (APIENTRY * COIN_PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target,
277                                                              GLenum pname,
278                                                              GLint * params);
279 typedef void (APIENTRY * COIN_PFNGLGETBUFFERPOINTERVPROC)(GLenum target,
280                                                           GLenum pname,
281                                                           GLvoid ** params);
282 
283 /* Typedefs for GL_NV_register_combiners */
284 typedef void (APIENTRY * COIN_PFNGLCOMBINERPARAMETERFVNVPROC)(GLenum pname,
285                                                               const GLfloat *params);
286 typedef void (APIENTRY * COIN_PFNGLCOMBINERPARAMETERIVNVPROC)(GLenum pname,
287                                                               const GLint *params);
288 typedef void (APIENTRY * COIN_PFNGLCOMBINERPARAMETERFNVPROC)(GLenum pname,
289                                                              GLfloat param);
290 typedef void (APIENTRY * COIN_PFNGLCOMBINERPARAMETERINVPROC)(GLenum pname,
291                                                             GLint param);
292 typedef void (APIENTRY * COIN_PFNGLCOMBINERINPUTNVPROC)(GLenum stage,
293                                                         GLenum portion,
294                                                         GLenum variable,
295                                                         GLenum input,
296                                                         GLenum mapping,
297                                                         GLenum componentUsage);
298 typedef void (APIENTRY * COIN_PFNGLCOMBINEROUTPUTNVPROC)(GLenum stage,
299                                                          GLenum portion,
300                                                          GLenum abOutput,
301                                                          GLenum cdOutput,
302                                                          GLenum sumOutput,
303                                                          GLenum scale,
304                                                          GLenum bias,
305                                                          GLboolean abDotProduct,
306                                                          GLboolean cdDotProduct,
307                                                          GLboolean muxSum);
308 typedef void (APIENTRY * COIN_PFNGLFINALCOMBINERINPUTNVPROC)(GLenum variable,
309                                                              GLenum input,
310                                                              GLenum mapping,
311                                                              GLenum componentUsage);
312 typedef void (APIENTRY * COIN_PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)(GLenum stage,
313                                                                       GLenum portion,
314                                                                       GLenum variable,
315                                                                       GLenum pname,
316                                                                       GLfloat *params);
317 typedef void (APIENTRY * COIN_PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)(GLenum stage,
318                                                                       GLenum portion,
319                                                                       GLenum variable,
320                                                                       GLenum pname,
321                                                                       GLint *params);
322 typedef void (APIENTRY * COIN_PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)(GLenum stage,
323                                                                        GLenum portion,
324                                                                        GLenum pname,
325                                                                        GLfloat *params);
326 typedef void (APIENTRY * COIN_PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)(GLenum stage,
327                                                                        GLenum portion,
328                                                                        GLenum pname,
329                                                                        GLint *params);
330 typedef void (APIENTRY * COIN_PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)(GLenum variable,
331                                                                            GLenum pname,
332                                                                            GLfloat *params);
333 typedef void (APIENTRY * COIN_PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)(GLenum variable,
334                                                                            GLenum pname,
335                                                                            GLint *params);
336 /* Typedefs for GL_ARB_fragment_program */
337 typedef void (APIENTRY * COIN_PFNGLPROGRAMSTRINGARBPROC)(GLenum target,
338                                                          GLenum format,
339                                                          GLsizei len,
340                                                          const GLvoid *string);
341 
342 typedef void (APIENTRY * COIN_PFNGLBINDPROGRAMARBPROC)(GLenum target,
343                                                        GLuint program);
344 
345 typedef void (APIENTRY * COIN_PFNGLDELETEPROGRAMSARBPROC)(GLsizei n,
346                                                           const GLuint *programs);
347 
348 typedef void (APIENTRY * COIN_PFNGLGENPROGRAMSARBPROC)(GLsizei n,
349                                                        GLuint *programs);
350 
351 typedef void (APIENTRY * COIN_PFNGLPROGRAMENVPARAMETER4DARBPROC)(GLenum target,
352                                                                  GLuint index,
353                                                                  GLdouble x,
354                                                                  GLdouble y,
355                                                                  GLdouble z,
356                                                                  GLdouble w);
357 typedef void (APIENTRY * COIN_PFNGLPROGRAMENVPARAMETER4DVARBPROC)(GLenum target,
358                                                                   GLuint index,
359                                                                   const GLdouble *params);
360 typedef void (APIENTRY * COIN_PFNGLPROGRAMENVPARAMETER4FARBPROC)(GLenum target,
361                                                                  GLuint index,
362                                                                  GLfloat x,
363                                                                  GLfloat y,
364                                                                  GLfloat z,
365                                                                  GLfloat w);
366 typedef void (APIENTRY * COIN_PFNGLPROGRAMENVPARAMETER4FVARBPROC)(GLenum target,
367                                                                   GLuint index,
368                                                                   const GLfloat *params);
369 typedef void (APIENTRY * COIN_PFNGLPROGRAMLOCALPARAMETER4DARBPROC)(GLenum target,
370                                                                    GLuint index,
371                                                                    GLdouble x,
372                                                                    GLdouble y,
373                                                                    GLdouble z,
374                                                                    GLdouble w);
375 typedef void (APIENTRY * COIN_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)(GLenum target,
376                                                                     GLuint index,
377                                                                     const GLdouble *params);
378 typedef void (APIENTRY * COIN_PFNGLPROGRAMLOCALPARAMETER4FARBPROC)(GLenum target,
379                                                                    GLuint index,
380                                                                    GLfloat x,
381                                                                    GLfloat y,
382                                                                    GLfloat z,
383                                                                    GLfloat w);
384 typedef void (APIENTRY * COIN_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)(GLenum target,
385                                                                     GLuint index,
386                                                                     const GLfloat *params);
387 typedef void (APIENTRY * COIN_PFNGLGETPROGRAMENVPARAMETERDVARBPROC)(GLenum target,
388                                                                     GLuint index,
389                                                                     GLdouble *params);
390 typedef void (APIENTRY * COIN_PFNGLGETPROGRAMENVPARAMETERFVARBPROC)(GLenum target,
391                                                                     GLuint index,
392                                                                     GLfloat *params);
393 typedef void (APIENTRY * COIN_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)(GLenum target,
394                                                                       GLuint index,
395                                                                       GLdouble *params);
396 typedef void (APIENTRY * COIN_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)(GLenum target,
397                                                                       GLuint index,
398                                                                       GLfloat *params);
399 typedef void (APIENTRY * COIN_PFNGLGETPROGRAMIVARBPROC)(GLenum target,
400                                                         GLenum pname,
401                                                         GLint *params);
402 typedef void (APIENTRY * COIN_PFNGLGETPROGRAMSTRINGARBPROC)(GLenum target,
403                                                             GLenum pname,
404                                                             GLvoid *string);
405 typedef GLboolean (APIENTRY * COIN_PFNGLISPROGRAMARBPROC)(GLuint program);
406 
407 
408 /* Typedefs for GL_ARB_vertex_program */
409 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB1SARBPROC)(GLuint index, GLshort x);
410 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB1FARBPROC)(GLuint index, GLfloat x);
411 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB1DARBPROC)(GLuint index, GLdouble x);
412 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB2SARBPROC)(GLuint index, GLshort x, GLshort y);
413 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB2FARBPROC)(GLuint index, GLfloat x, GLfloat y);
414 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB2DARBPROC)(GLuint index, GLdouble x, GLdouble y);
415 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB3SARBPROC)(GLuint index, GLshort x,
416                                                           GLshort y, GLshort z);
417 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB3FARBPROC)(GLuint index, GLfloat x,
418                                                           GLfloat y, GLfloat z);
419 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB3DARBPROC)(GLuint index, GLdouble x,
420                                                           GLdouble y, GLdouble z);
421 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4SARBPROC)(GLuint index, GLshort x,
422                                                           GLshort y, GLshort z, GLshort w);
423 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4FARBPROC)(GLuint index, GLfloat x,
424                                                           GLfloat y, GLfloat z, GLfloat w);
425 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4DARBPROC)(GLuint index, GLdouble x,
426                                                           GLdouble y, GLdouble z, GLdouble w);
427 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4NUBARBPROC)(GLuint index, GLubyte x,
428                                                             GLubyte y, GLubyte z, GLubyte w);
429 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB1SVARBPROC)(GLuint index, const GLshort *v);
430 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB1FVARBPROC)(GLuint index, const GLfloat *v);
431 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB1DVARBPROC)(GLuint index, const GLdouble *v);
432 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB2SVARBPROC)(GLuint index, const GLshort *v);
433 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB2FVARBPROC)(GLuint index, const GLfloat *v);
434 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB2DVARBPROC)(GLuint index, const GLdouble *v);
435 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB3SVARBPROC)(GLuint index, const GLshort *v);
436 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB3FVARBPROC)(GLuint index, const GLfloat *v);
437 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB3DVARBPROC)(GLuint index, const GLdouble *v);
438 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4BVARBPROC)(GLuint index, const GLbyte *v);
439 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4SVARBPROC)(GLuint index, const GLshort *v);
440 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4IVARBPROC)(GLuint index, const GLint *v);
441 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4UBVARBPROC)(GLuint index, const GLubyte *v);
442 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4USVARBPROC)(GLuint index, const GLushort *v);
443 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4UIVARBPROC)(GLuint index, const GLuint *v);
444 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4FVARBPROC)(GLuint index, const GLfloat *v);
445 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4DVARBPROC)(GLuint index, const GLdouble *v);
446 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4NBVARBPROC)(GLuint index, const GLbyte *v);
447 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4NSVARBPROC)(GLuint index, const GLshort *v);
448 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4NIVARBPROC)(GLuint index, const GLint *v);
449 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4NUBVARBPROC)(GLuint index, const GLubyte *v);
450 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4NUSVARBPROC)(GLuint index, const GLushort *v);
451 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIB4NUIVARBPROC)(GLuint index, const GLuint *v);
452 typedef void (APIENTRY * COIN_PFNGLVERTEXATTRIBPOINTERARBPROC)(GLuint index, GLint size,
453                                                                GLenum type, GLboolean normalized,
454                                                                GLsizei stride,
455                                                                const GLvoid *pointer);
456 typedef void (APIENTRY * COIN_PFNGLENABLEVERTEXATTRIBARRAYARBPROC)(GLuint index);
457 typedef void (APIENTRY * COIN_PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)(GLuint index);
458 typedef void (APIENTRY * COIN_PFNGLGETVERTEXATTRIBDVARBPROC)(GLuint index, GLenum pname,
459                                                              GLdouble *params);
460 typedef void (APIENTRY * COIN_PFNGLGETVERTEXATTRIBFVARBPROC)(GLuint index, GLenum pname,
461                                                              GLfloat *params);
462 typedef void (APIENTRY * COIN_PFNGLGETVERTEXATTRIBIVARBPROC)(GLuint index, GLenum pname,
463                                                              GLint *params);
464 typedef void (APIENTRY * COIN_PFNGLGETVERTEXATTRIBPOINTERVARBPROC)(GLuint index, GLenum pname,
465                                                                    GLvoid **pointer);
466 
467 /* FIXME: according to the GL_ARB_shader_objects doc, these types must
468    be at least 8 bits wide and 32 bits wide, respectively. Apart from
469    that, there does not seem to be any other limitations on them, so
470    these types may not match the actual types used on the platform
471    (these were taken from NVIDIA's glext.h for their 32-bit Linux
472    drivers). How should this be properly handled? Is there any way at
473    all one could possibly pick up these at the correct size in a
474    dynamic manner? 20050124 mortene. */
475 typedef char COIN_GLchar;
476 typedef unsigned long COIN_GLhandle;
477 
478 /* Typedefs for GL_ARB_vertex_shader */
479 typedef void (APIENTRY * COIN_PFNGLBINDATTRIBLOCATIONARBPROC)(COIN_GLhandle programobj, GLuint index, COIN_GLchar * name);
480 typedef int (APIENTRY * COIN_PFNGLGETATTRIBLOCATIONARBPROC)(COIN_GLhandle programobj, const COIN_GLchar * name);
481 typedef void (APIENTRY * COIN_PFNGLGETACTIVEATTRIBARBPROC)(COIN_GLhandle programobj, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, COIN_GLchar * name);
482 
483 
484 /* Typedefs for shader objects -- GL_ARB_shader_objects */
485 typedef void (APIENTRY * COIN_PFNGLPROGRAMPARAMETERIEXT)(COIN_GLhandle, GLenum, GLenum);
486 
487 typedef int (APIENTRY * COIN_PFNGLGETUNIFORMLOCATIONARBPROC)(COIN_GLhandle,
488                                                              const COIN_GLchar *);
489 typedef void (APIENTRY * COIN_PFNGLGETACTIVEUNIFORMARBPROC)(COIN_GLhandle,
490                                                             GLuint index,
491                                                             GLsizei maxLength,
492                                                             GLsizei * length,
493                                                             GLint * size,
494                                                             GLenum * type,
495                                                             COIN_GLchar * name);
496 typedef void (APIENTRY * COIN_PFNGLUNIFORM1FARBPROC)(GLint location, GLfloat v0);
497 typedef void (APIENTRY * COIN_PFNGLUNIFORM2FARBPROC)(GLint location, GLfloat v0, GLfloat v1);
498 typedef void (APIENTRY * COIN_PFNGLUNIFORM3FARBPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
499 typedef void (APIENTRY * COIN_PFNGLUNIFORM4FARBPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
500 typedef COIN_GLhandle (APIENTRY * COIN_PFNGLCREATESHADEROBJECTARBPROC)(GLenum);
501 typedef void (APIENTRY * COIN_PFNGLSHADERSOURCEARBPROC)(COIN_GLhandle, GLsizei, const COIN_GLchar **, const GLint *);
502 typedef void (APIENTRY * COIN_PFNGLCOMPILESHADERARBPROC)(COIN_GLhandle);
503 typedef void (APIENTRY * COIN_PFNGLGETOBJECTPARAMETERIVARBPROC)(COIN_GLhandle, GLenum, GLint *);
504 typedef void (APIENTRY * COIN_PFNGLDELETEOBJECTARBPROC)(COIN_GLhandle);
505 typedef void (APIENTRY * COIN_PFNGLATTACHOBJECTARBPROC)(COIN_GLhandle, COIN_GLhandle);
506 typedef void (APIENTRY * COIN_PFNGLDETACHOBJECTARBPROC)(COIN_GLhandle, COIN_GLhandle);
507 typedef void (APIENTRY * COIN_PFNGLGETINFOLOGARBPROC)(COIN_GLhandle, GLsizei, GLsizei *, COIN_GLchar *);
508 typedef void (APIENTRY * COIN_PFNGLLINKPROGRAMARBPROC)(COIN_GLhandle);
509 typedef void (APIENTRY * COIN_PFNGLUSEPROGRAMOBJECTARBPROC)(COIN_GLhandle);
510 typedef COIN_GLhandle (APIENTRY * COIN_PFNGLCREATEPROGRAMOBJECTARBPROC)(void);
511 typedef void (APIENTRY * COIN_PFNGLUNIFORM1FVARBPROC)(COIN_GLhandle, GLsizei, const GLfloat *);
512 typedef void (APIENTRY * COIN_PFNGLUNIFORM2FVARBPROC)(COIN_GLhandle, GLsizei, const GLfloat *);
513 typedef void (APIENTRY * COIN_PFNGLUNIFORM3FVARBPROC)(COIN_GLhandle, GLsizei, const GLfloat *);
514 typedef void (APIENTRY * COIN_PFNGLUNIFORM4FVARBPROC)(COIN_GLhandle, GLsizei, const GLfloat *);
515 typedef void (APIENTRY * COIN_PFNGLUNIFORM1IARBPROC)(COIN_GLhandle, const GLint);
516 typedef void (APIENTRY * COIN_PFNGLUNIFORM2IARBPROC)(COIN_GLhandle, const GLint, GLint);
517 typedef void (APIENTRY * COIN_PFNGLUNIFORM3IARBPROC)(COIN_GLhandle, const GLint, GLint, GLint);
518 typedef void (APIENTRY * COIN_PFNGLUNIFORM4IARBPROC)(COIN_GLhandle, const GLint, GLint, GLint, GLint);
519 typedef void (APIENTRY * COIN_PFNGLUNIFORM1IVARBPROC)(COIN_GLhandle, GLsizei, const GLint *);
520 typedef void (APIENTRY * COIN_PFNGLUNIFORM2IVARBPROC)(COIN_GLhandle, GLsizei, const GLint *);
521 typedef void (APIENTRY * COIN_PFNGLUNIFORM3IVARBPROC)(COIN_GLhandle, GLsizei, const GLint *);
522 typedef void (APIENTRY * COIN_PFNGLUNIFORM4IVARBPROC)(COIN_GLhandle, GLsizei, const GLint *);
523 
524 typedef void (APIENTRY * COIN_PFNGLUNIFORMMATRIX2FVARBPROC)(COIN_GLhandle, GLsizei, GLboolean, const GLfloat *);
525 typedef void (APIENTRY * COIN_PFNGLUNIFORMMATRIX3FVARBPROC)(COIN_GLhandle, GLsizei, GLboolean, const GLfloat *);
526 typedef void (APIENTRY * COIN_PFNGLUNIFORMMATRIX4FVARBPROC)(COIN_GLhandle, GLsizei, GLboolean, const GLfloat *);
527 
528 
529 /* Typedefs for occlusion queries -- GL_ARB_occlusion_query */
530 
531 typedef void (APIENTRY * COIN_PFNGLGENQUERIESPROC)(GLsizei n, GLuint * ids);
532 typedef void (APIENTRY * COIN_PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids);
533 typedef GLboolean (APIENTRY * COIN_PFNGLISQUERYPROC)(GLuint id);
534 typedef void (APIENTRY * COIN_PFNGLBEGINQUERYPROC)(GLenum target, GLuint id);
535 typedef void (APIENTRY * COIN_PFNGLENDQUERYPROC)(GLenum target);
536 typedef void (APIENTRY * COIN_PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint * params);
537 typedef void (APIENTRY * COIN_PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint * params);
538 typedef void (APIENTRY * COIN_PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint * params);
539 
540 /* Typedefs for GLX functions. */
541 typedef void *(APIENTRY * COIN_PFNGLXGETCURRENTDISPLAYPROC)(void);
542 typedef void *(APIENTRY * COIN_PFNGLXGETPROCADDRESSPROC)(const GLubyte *);
543 
544 
545 /* Typedefs for Framebuffer objects */
546 
547 typedef void (APIENTRY * COIN_PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer);
548 typedef void (APIENTRY * COIN_PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer);
549 typedef void (APIENTRY * COIN_PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers);
550 typedef void (APIENTRY * COIN_PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers);
551 typedef void (APIENTRY * COIN_PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
552 typedef void (APIENTRY * COIN_PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params);
553 typedef GLboolean (APIENTRY * COIN_PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer);
554 typedef void (APIENTRY * COIN_PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer);
555 typedef void (APIENTRY * COIN_PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers);
556 typedef void (APIENTRY * COIN_PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers);
557 typedef GLenum (APIENTRY * COIN_PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target);
558 typedef void (APIENTRY * COIN_PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
559 typedef void (APIENTRY * COIN_PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
560 typedef void (APIENTRY * COIN_PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
561 typedef void (APIENTRY * COIN_PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
562 typedef void (APIENTRY * COIN_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
563 typedef void (APIENTRY * COIN_PFNGLGENERATEMIPMAPPROC)(GLenum target);
564 
565 /* Typedef for new extension string method */
566 
567 typedef GLubyte* (APIENTRY * COIN_PFNGLGETSTRINGIPROC) (GLenum target, GLuint idx);
568 
569 
570 /* ********************************************************************** */
571 
572 /* Type specification for GLX info storage structure, embedded within
573    the main GL info structure below. */
574 struct cc_glxglue {
575   struct {
576     int major, minor;
577   } version;
578 
579   SbBool isdirect;
580 
581   const char * serverversion;
582   const char * servervendor;
583   const char * serverextensions;
584 
585   const char * clientversion;
586   const char * clientvendor;
587   const char * clientextensions;
588 
589   const char * glxextensions;
590 
591   COIN_PFNGLXGETCURRENTDISPLAYPROC glXGetCurrentDisplay;
592   COIN_PFNGLXGETPROCADDRESSPROC glXGetProcAddress;
593   SbBool tried_bind_glXGetProcAddress;
594 };
595 
596 /* ********************************************************************** */
597 
598 /* GL info storage structure. An instance will be allocated and
599    initialized for each new GL context id. */
600 struct cc_glglue {
601 
602   uint32_t contextid;
603   struct { /* OpenGL versioning. */
604     unsigned int major, minor, release;
605   } version;
606 
607   /* OpenGL calls. Will be NULL if not available, otherwise they
608      contain a valid function pointer into the OpenGL library. */
609   COIN_PFNGLPOLYGONOFFSETPROC glPolygonOffset;
610   COIN_PFNGLPOLYGONOFFSETPROC glPolygonOffsetEXT;
611 
612   COIN_PFNGLGENTEXTURESPROC glGenTextures;
613   COIN_PFNGLBINDTEXTUREPROC glBindTexture;
614   COIN_PFNGLDELETETEXTURESPROC glDeleteTextures;
615 
616   COIN_PFNGLTEXIMAGE3DPROC glTexImage3D;
617   COIN_PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D;
618   COIN_PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D;
619   COIN_PFNGLTEXSUBIMAGE2DPROC glTexSubImage2D;
620 
621   COIN_PFNGLACTIVETEXTUREPROC glActiveTexture;
622   COIN_PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
623   COIN_PFNGLMULTITEXCOORD2FPROC glMultiTexCoord2f;
624   COIN_PFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv;
625   COIN_PFNGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv;
626   COIN_PFNGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv;
627 
628   COIN_PFNGLCOLORTABLEPROC glColorTable;
629   COIN_PFNGLCOLORSUBTABLEPROC glColorSubTable;
630   COIN_PFNGLGETCOLORTABLEPROC glGetColorTable;
631   COIN_PFNGLGETCOLORTABLEPARAMETERIVPROC glGetColorTableParameteriv;
632   COIN_PFNGLGETCOLORTABLEPARAMETERFVPROC glGetColorTableParameterfv;
633 
634   SbBool supportsPalettedTextures;
635 
636   COIN_PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D;
637   COIN_PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
638   COIN_PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D;
639   COIN_PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D;
640   COIN_PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D;
641   COIN_PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D;
642   COIN_PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
643 
644   COIN_PFNGLBLENDEQUATIONPROC glBlendEquation;
645   COIN_PFNGLBLENDEQUATIONPROC glBlendEquationEXT;
646 
647   COIN_PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
648 
649   COIN_PFNGLVERTEXPOINTERPROC glVertexPointer;
650   COIN_PFNGLTEXCOORDPOINTERPROC glTexCoordPointer;
651   COIN_PFNGLNORMALPOINTERPROC glNormalPointer;
652   COIN_PNFGLCOLORPOINTERPROC glColorPointer;
653   COIN_PFNGLINDEXPOINTERPROC glIndexPointer;
654   COIN_PFNGLENABLECLIENTSTATEPROC glEnableClientState;
655   COIN_PFNGLDISABLECLIENTSTATEPROC glDisableClientState;
656   COIN_PFNGLINTERLEAVEDARRAYSPROC glInterleavedArrays;
657   COIN_PFNGLDRAWARRAYSPROC glDrawArrays;
658   COIN_PFNGLDRAWELEMENTSPROC glDrawElements;
659   COIN_PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
660   COIN_PFNGLARRAYELEMENTPROC glArrayElement;
661 
662   COIN_PFNGLMULTIDRAWARRAYSPROC glMultiDrawArrays;
663   COIN_PFNGLMULTIDRAWELEMENTSPROC glMultiDrawElements;
664 
665   COIN_PFNGLVERTEXARRAYRANGENVPROC glVertexArrayRangeNV;
666   COIN_PFNGLFLUSHVERTEXARRAYRANGENVPROC glFlushVertexArrayRangeNV;
667   COIN_PFNGLALLOCATEMEMORYNVPROC glAllocateMemoryNV;
668   COIN_PFNGLFREEMEMORYNVPROC glFreeMemoryNV;
669 
670   COIN_PFNGLBINDBUFFERPROC glBindBuffer;
671   COIN_PFNGLDELETEBUFFERSPROC glDeleteBuffers;
672   COIN_PFNGLGENBUFFERSPROC glGenBuffers;
673   COIN_PFNGLISBUFFERPROC glIsBuffer;
674   COIN_PFNGLBUFFERDATAPROC glBufferData;
675   COIN_PFNGLBUFFERSUBDATAPROC glBufferSubData;
676   COIN_PFNGLGETBUFFERSUBDATAPROC glGetBufferSubData;
677   COIN_PNFGLMAPBUFFERPROC glMapBuffer;
678   COIN_PFNGLUNMAPBUFFERPROC glUnmapBuffer;
679   COIN_PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv;
680   COIN_PFNGLGETBUFFERPOINTERVPROC glGetBufferPointerv;
681 
682   /* NV register combiners */
683   COIN_PFNGLCOMBINERPARAMETERFVNVPROC glCombinerParameterfvNV;
684   COIN_PFNGLCOMBINERPARAMETERIVNVPROC glCombinerParameterivNV;
685   COIN_PFNGLCOMBINERPARAMETERFNVPROC glCombinerParameterfNV;
686   COIN_PFNGLCOMBINERPARAMETERINVPROC glCombinerParameteriNV;
687   COIN_PFNGLCOMBINERINPUTNVPROC glCombinerInputNV;
688   COIN_PFNGLCOMBINEROUTPUTNVPROC glCombinerOutputNV;
689   COIN_PFNGLFINALCOMBINERINPUTNVPROC glFinalCombinerInputNV;
690   COIN_PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC glGetCombinerInputParameterfvNV;
691   COIN_PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC glGetCombinerInputParameterivNV;
692   COIN_PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC glGetCombinerOutputParameterfvNV;
693   COIN_PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC glGetCombinerOutputParameterivNV;
694   COIN_PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC glGetFinalCombinerInputParameterfvNV;
695   COIN_PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC glGetFinalCombinerInputParameterivNV;
696 
697   /* fragment program */
698   COIN_PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
699   COIN_PFNGLBINDPROGRAMARBPROC glBindProgramARB;
700   COIN_PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB;
701   COIN_PFNGLGENPROGRAMSARBPROC glGenProgramsARB;
702   COIN_PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB;
703   COIN_PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB;
704   COIN_PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB;
705   COIN_PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB;
706   COIN_PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB;
707   COIN_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB;
708   COIN_PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB;
709   COIN_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB;
710   COIN_PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB;
711   COIN_PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB;
712   COIN_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB;
713   COIN_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB;
714   COIN_PFNGLGETPROGRAMIVARBPROC glGetProgramivARB;
715   COIN_PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB;
716   COIN_PFNGLISPROGRAMARBPROC glIsProgramARB;
717 
718   /* vertex program */
719   COIN_PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB;
720   COIN_PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB;
721   COIN_PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB;
722   COIN_PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB;
723   COIN_PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB;
724   COIN_PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB;
725   COIN_PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB;
726   COIN_PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB;
727   COIN_PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB;
728   COIN_PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB;
729   COIN_PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB;
730   COIN_PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB;
731   COIN_PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4NubARB;
732   COIN_PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB;
733   COIN_PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB;
734   COIN_PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB;
735   COIN_PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB;
736   COIN_PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB;
737   COIN_PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB;
738   COIN_PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB;
739   COIN_PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB;
740   COIN_PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB;
741   COIN_PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB;
742   COIN_PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB;
743   COIN_PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB;
744   COIN_PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB;
745   COIN_PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB;
746   COIN_PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB;
747   COIN_PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB;
748   COIN_PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB;
749   COIN_PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4NbvARB;
750   COIN_PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4NsvARB;
751   COIN_PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4NivARB;
752   COIN_PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4NubvARB;
753   COIN_PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4NusvARB;
754   COIN_PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4NuivARB;
755   COIN_PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
756   COIN_PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
757   COIN_PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
758   COIN_PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB;
759   COIN_PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB;
760   COIN_PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB;
761   COIN_PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB;
762 
763   /* vertex shader */
764   COIN_PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB;
765   COIN_PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB;
766   COIN_PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
767 
768   /* shader objects */
769   COIN_PFNGLPROGRAMPARAMETERIEXT glProgramParameteriEXT;
770   COIN_PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
771   COIN_PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB;
772   COIN_PFNGLUNIFORM1FARBPROC glUniform1fARB;
773   COIN_PFNGLUNIFORM2FARBPROC glUniform2fARB;
774   COIN_PFNGLUNIFORM3FARBPROC glUniform3fARB;
775   COIN_PFNGLUNIFORM4FARBPROC glUniform4fARB;
776   COIN_PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
777   COIN_PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
778   COIN_PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
779   COIN_PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
780   COIN_PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
781   COIN_PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
782   COIN_PFNGLDETACHOBJECTARBPROC glDetachObjectARB;
783   COIN_PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
784   COIN_PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
785   COIN_PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
786   COIN_PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
787   COIN_PFNGLUNIFORM1FVARBPROC glUniform1fvARB;
788   COIN_PFNGLUNIFORM2FVARBPROC glUniform2fvARB;
789   COIN_PFNGLUNIFORM3FVARBPROC glUniform3fvARB;
790   COIN_PFNGLUNIFORM4FVARBPROC glUniform4fvARB;
791   COIN_PFNGLUNIFORM1IARBPROC glUniform1iARB;
792   COIN_PFNGLUNIFORM2IARBPROC glUniform2iARB;
793   COIN_PFNGLUNIFORM3IARBPROC glUniform3iARB;
794   COIN_PFNGLUNIFORM4IARBPROC glUniform4iARB;
795   COIN_PFNGLUNIFORM1IVARBPROC glUniform1ivARB;
796   COIN_PFNGLUNIFORM2IVARBPROC glUniform2ivARB;
797   COIN_PFNGLUNIFORM3IVARBPROC glUniform3ivARB;
798   COIN_PFNGLUNIFORM4IVARBPROC glUniform4ivARB;
799   COIN_PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB;
800   COIN_PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB;
801   COIN_PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB;
802 
803   COIN_PFNGLPUSHCLIENTATTRIBPROC glPushClientAttrib;
804   COIN_PFNGLPOPCLIENTATTRIBPROC glPopClientAttrib;
805 
806   COIN_PFNGLGENQUERIESPROC glGenQueries;
807   COIN_PFNGLDELETEQUERIESPROC glDeleteQueries;
808   COIN_PFNGLISQUERYPROC glIsQuery;
809   COIN_PFNGLBEGINQUERYPROC glBeginQuery;
810   COIN_PFNGLENDQUERYPROC glEndQuery;
811   COIN_PFNGLGETQUERYIVPROC glGetQueryiv;
812   COIN_PFNGLGETQUERYOBJECTIVPROC glGetQueryObjectiv;
813   COIN_PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv;
814 
815   /* FBO */
816   COIN_PFNGLISRENDERBUFFERPROC glIsRenderbuffer;
817   COIN_PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
818   COIN_PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers;
819   COIN_PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
820   COIN_PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage;
821   COIN_PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv;
822   COIN_PFNGLISFRAMEBUFFERPROC glIsFramebuffer;
823   COIN_PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
824   COIN_PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
825   COIN_PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
826   COIN_PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
827   COIN_PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D;
828   COIN_PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
829   COIN_PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D;
830   COIN_PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;
831   COIN_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv;
832   COIN_PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
833 
834   /* glGetStringi - part of replacement for obsolete glGetString(GL_EXTENSIONS) in OpenGL 3.0 */
835   COIN_PFNGLGETSTRINGIPROC glGetStringi;
836 
837   const char * versionstr;
838   const char * vendorstr;
839   SbBool vendor_is_SGI;
840   SbBool vendor_is_nvidia;
841   SbBool vendor_is_intel;
842   SbBool vendor_is_ati;
843   SbBool vendor_is_3dlabs;
844   SbBool nvidia_color_per_face_bug;
845   const char * rendererstr;
846   const char * extensionsstr;
847   int maxtextureunits;
848   struct cc_glxglue glx;
849   float max_anisotropy;
850 
851   /* normalization cube map */
852   GLuint normalizationcubemap;
853   GLuint specularlookup;
854 
855   SbBool can_do_bumpmapping;
856   SbBool can_do_sortedlayersblend;
857   SbBool can_do_anisotropic_filtering;
858 
859   SbBool has_nv_register_combiners;
860   SbBool has_ext_texture_rectangle;
861   SbBool has_nv_texture_shader;
862   SbBool has_depth_texture;
863   SbBool has_shadow;
864   SbBool has_arb_fragment_program;
865   SbBool has_arb_vertex_program;
866   SbBool has_arb_shader_objects;
867   SbBool has_arb_vertex_shader;
868   SbBool has_texture_env_combine;
869   SbBool has_fbo;
870 
871   SbBool vbo_in_displaylist_ok;
872   SbBool non_power_of_two_textures;
873   int max_lights;
874   float line_width_range[2];
875   float point_size_range[2];
876   int max_texture_size;
877   cc_dict * glextdict;
878 
879   cc_libhandle dl_handle;
880 };
881 
882 /* ********************************************************************** */
883 
884 /* Called from SoContextHandler::destructingContext() to be able
885    to deallocated the cc_glglue instance. */
886 
887 void coin_glglue_destruct(uint32_t contextid);
888 
889 /* ********************************************************************** */
890 
891 /* Primarily used internally from functions that are badly designed,
892    lacking a cc_glglue* argument in the function signature.
893 
894    Note: you should try to avoid using this function if possible! */
895 
896 void * coin_gl_current_context(void);
897 
898 /* ********************************************************************** */
899 
900 /*
901  * Needed for a hack in SoVertexShader and SoFramgmentShader
902  * Will be removed soon.
903  */
904 const cc_glglue * cc_glglue_instance_from_context_ptr(void * ptr);
905 
906 /* ********************************************************************** */
907 
908 /* Scanning for and printing info about current set of glGetError()s. */
909 unsigned int coin_catch_gl_errors(cc_string *);
910 /* Convert OpenGL glGetError() error code to string. */
911 const char * coin_glerror_string(GLenum errorcode);
912 
913 /* ********************************************************************** */
914 
915 /* Exported internally to gl_glx.c / gl_wgl.c / gl_agl.c. */
916 int coin_glglue_debug(void);
917 int coin_glglue_extension_available(const char * extensions, const char * ext);
918 
919 int coin_glglue_stencil_bits_hack(void);
920 
921 /* ********************************************************************** */
922 
923 /* needed for bumpmap rendering */
924 void coin_apply_normalization_cube_map(const cc_glglue * glue);
925 
926 /* ********************************************************************** */
927 
928 /* ARB_shader_objects */
929 SbBool cc_glglue_has_arb_shader_objects(const cc_glglue * glue);
930 
931 /* Moved from gl.h and added compressed parameter.
932    Original function is deprecated for internal use.
933 */
934 SbBool coin_glglue_is_texture_size_legal(const cc_glglue * glw,
935                                          int xsize, int ysize, int zsize,
936                                          GLenum internalformat,
937                                          GLenum format,
938                                          GLenum type,
939                                          SbBool mipmap);
940 
941 GLint coin_glglue_get_internal_texture_format(const cc_glglue * glw,
942                                               int numcomponents,
943                                               SbBool compress);
944 
945 GLenum coin_glglue_get_texture_format(const cc_glglue * glw, int numcomponents);
946 SbBool coin_glglue_vbo_in_displaylist_supported(const cc_glglue * glw);
947 SbBool coin_glglue_non_power_of_two_textures(const cc_glglue * glue);
948 SbBool coin_glglue_has_generate_mipmap(const cc_glglue * glue);
949 
950 /* context creation callback */
951 typedef void coin_glglue_instance_created_cb(const uint32_t contextid, void * closure);
952 void coin_glglue_add_instance_created_callback(coin_glglue_instance_created_cb * cb,
953                                                void * closure);
954 
955 cc_libhandle coin_glglue_dl_handle(const cc_glglue * glw);
956 
957 #ifdef __cplusplus
958 }
959 #endif /* __cplusplus */
960 
961 #endif /* !COIN_GLUE_GLP_H */
962