OpenGL: Make use of the requested version and profile in QGLWidget
[profile/ivi/qtbase.git] / src / opengl / qglfunctions.cpp
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtOpenGL module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #include "qglfunctions.h"
43 #include "qgl_p.h"
44 #include "QtGui/private/qopenglcontext_p.h"
45
46 QT_BEGIN_NAMESPACE
47
48 /*!
49     \class QGLFunctions
50     \brief The QGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API.
51     \since 4.8
52     \obsolete
53     \ingroup painting-3D
54
55     OpenGL/ES 2.0 defines a subset of the OpenGL specification that is
56     common across many desktop and embedded OpenGL implementations.
57     However, it can be difficult to use the functions from that subset
58     because they need to be resolved manually on desktop systems.
59
60     QGLFunctions provides a guaranteed API that is available on all
61     OpenGL systems and takes care of function resolution on systems
62     that need it.  The recommended way to use QGLFunctions is by
63     direct inheritance:
64
65     \code
66     class MyGLWidget : public QGLWidget, protected QGLFunctions
67     {
68         Q_OBJECT
69     public:
70         MyGLWidget(QWidget *parent = 0) : QGLWidget(parent) {}
71
72     protected:
73         void initializeGL();
74         void paintGL();
75     };
76
77     void MyGLWidget::initializeGL()
78     {
79         initializeGLFunctions();
80     }
81     \endcode
82
83     The \c{paintGL()} function can then use any of the OpenGL/ES 2.0
84     functions without explicit resolution, such as glActiveTexture()
85     in the following example:
86
87     \code
88     void MyGLWidget::paintGL()
89     {
90         glActiveTexture(GL_TEXTURE1);
91         glBindTexture(GL_TEXTURE_2D, textureId);
92         ...
93     }
94     \endcode
95
96     QGLFunctions can also be used directly for ad-hoc invocation
97     of OpenGL/ES 2.0 functions on all platforms:
98
99     \code
100     QGLFunctions glFuncs(QGLContext::currentContext());
101     glFuncs.glActiveTexture(GL_TEXTURE1);
102     \endcode
103
104     QGLFunctions provides wrappers for all OpenGL/ES 2.0 functions,
105     except those like \c{glDrawArrays()}, \c{glViewport()}, and
106     \c{glBindTexture()} that don't have portability issues.
107
108     Including the header for QGLFunctions will also define all of
109     the OpenGL/ES 2.0 macro constants that are not already defined by
110     the system's OpenGL headers, such as \c{GL_TEXTURE1} above.
111
112     The hasOpenGLFeature() and openGLFeatures() functions can be used
113     to determine if the OpenGL implementation has a major OpenGL/ES 2.0
114     feature.  For example, the following checks if non power of two
115     textures are available:
116
117     \code
118     QGLFunctions funcs(QGLContext::currentContext());
119     bool npot = funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures);
120     \endcode
121
122     \note This class has been deprecated in favor of QOpenGLFunctions.
123 */
124
125 /*!
126     \enum QGLFunctions::OpenGLFeature
127     This enum defines OpenGL/ES 2.0 features that may be optional
128     on other platforms.
129
130     \value Multitexture glActiveTexture() function is available.
131     \value Shaders Shader functions are available.
132     \value Buffers Vertex and index buffer functions are available.
133     \value Framebuffers Framebuffer object functions are available.
134     \value BlendColor glBlendColor() is available.
135     \value BlendEquation glBlendEquation() is available.
136     \value BlendEquationSeparate glBlendEquationSeparate() is available.
137     \value BlendFuncSeparate glBlendFuncSeparate() is available.
138     \value BlendSubtract Blend subtract mode is available.
139     \value CompressedTextures Compressed texture functions are available.
140     \value Multisample glSampleCoverage() function is available.
141     \value StencilSeparate Separate stencil functions are available.
142     \value NPOTTextures Non power of two textures are available.
143 */
144
145 // Hidden private fields for additional extension data.
146 struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate, public QOpenGLSharedResource
147 {
148     QGLFunctionsPrivateEx(QOpenGLContext *context)
149         : QGLFunctionsPrivate(QGLContext::fromOpenGLContext(context))
150         , QOpenGLSharedResource(context->shareGroup())
151         , m_features(-1) {}
152
153     void invalidateResource()
154     {
155         m_features = -1;
156     }
157
158     void freeResource(QOpenGLContext *)
159     {
160         // no gl resources to free
161     }
162
163     int m_features;
164 };
165
166 Q_GLOBAL_STATIC(QOpenGLMultiGroupSharedResource, qt_gl_functions_resource)
167
168 static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0)
169 {
170     if (!context)
171         context = QGLContext::currentContext();
172     Q_ASSERT(context);
173     QGLFunctionsPrivateEx *funcs =
174         reinterpret_cast<QGLFunctionsPrivateEx *>
175             (qt_gl_functions_resource()->value<QGLFunctionsPrivateEx>(context->contextHandle()));
176     return funcs;
177 }
178
179 /*!
180     Constructs a default function resolver.  The resolver cannot
181     be used until initializeGLFunctions() is called to specify
182     the context.
183
184     \sa initializeGLFunctions()
185 */
186 QGLFunctions::QGLFunctions()
187     : d_ptr(0)
188 {
189 }
190
191 /*!
192     Constructs a function resolver for \a context.  If \a context
193     is null, then the resolver will be created for the current QGLContext.
194
195     An object constructed in this way can only be used with \a context
196     and other contexts that share with it.  Use initializeGLFunctions()
197     to change the object's context association.
198
199     \sa initializeGLFunctions()
200 */
201 QGLFunctions::QGLFunctions(const QGLContext *context)
202     : d_ptr(qt_gl_functions(context))
203 {
204 }
205
206 /*!
207     \fn QGLFunctions::~QGLFunctions()
208
209     Destroys this function resolver.
210 */
211
212 static int qt_gl_resolve_features()
213 {
214 #if defined(QT_OPENGL_ES_2)
215     int features = QGLFunctions::Multitexture |
216                    QGLFunctions::Shaders |
217                    QGLFunctions::Buffers |
218                    QGLFunctions::Framebuffers |
219                    QGLFunctions::BlendColor |
220                    QGLFunctions::BlendEquation |
221                    QGLFunctions::BlendEquationSeparate |
222                    QGLFunctions::BlendFuncSeparate |
223                    QGLFunctions::BlendSubtract |
224                    QGLFunctions::CompressedTextures |
225                    QGLFunctions::Multisample |
226                    QGLFunctions::StencilSeparate;
227     QGLExtensionMatcher extensions;
228     if (extensions.match("GL_OES_texture_npot"))
229         features |= QGLFunctions::NPOTTextures;
230     if (extensions.match("GL_IMG_texture_npot"))
231         features |= QGLFunctions::NPOTTextures;
232     return features;
233 #elif defined(QT_OPENGL_ES)
234     int features = QGLFunctions::Multitexture |
235                    QGLFunctions::Buffers |
236                    QGLFunctions::CompressedTextures |
237                    QGLFunctions::Multisample;
238     QGLExtensionMatcher extensions;
239     if (extensions.match("GL_OES_framebuffer_object"))
240         features |= QGLFunctions::Framebuffers;
241     if (extensions.match("GL_OES_blend_equation_separate"))
242         features |= QGLFunctions::BlendEquationSeparate;
243     if (extensions.match("GL_OES_blend_func_separate"))
244         features |= QGLFunctions::BlendFuncSeparate;
245     if (extensions.match("GL_OES_blend_subtract"))
246         features |= QGLFunctions::BlendSubtract;
247     if (extensions.match("GL_OES_texture_npot"))
248         features |= QGLFunctions::NPOTTextures;
249     if (extensions.match("GL_IMG_texture_npot"))
250         features |= QGLFunctions::NPOTTextures;
251     return features;
252 #else
253     int features = 0;
254     QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags();
255     QGLExtensionMatcher extensions;
256
257     // Recognize features by extension name.
258     if (extensions.match("GL_ARB_multitexture"))
259         features |= QGLFunctions::Multitexture;
260     if (extensions.match("GL_ARB_shader_objects"))
261         features |= QGLFunctions::Shaders;
262     if (extensions.match("GL_EXT_framebuffer_object") ||
263             extensions.match("GL_ARB_framebuffer_object"))
264         features |= QGLFunctions::Framebuffers;
265     if (extensions.match("GL_EXT_blend_color"))
266         features |= QGLFunctions::BlendColor;
267     if (extensions.match("GL_EXT_blend_equation_separate"))
268         features |= QGLFunctions::BlendEquationSeparate;
269     if (extensions.match("GL_EXT_blend_func_separate"))
270         features |= QGLFunctions::BlendFuncSeparate;
271     if (extensions.match("GL_EXT_blend_subtract"))
272         features |= QGLFunctions::BlendSubtract;
273     if (extensions.match("GL_ARB_texture_compression"))
274         features |= QGLFunctions::CompressedTextures;
275     if (extensions.match("GL_ARB_multisample"))
276         features |= QGLFunctions::Multisample;
277     if (extensions.match("GL_ARB_texture_non_power_of_two"))
278         features |= QGLFunctions::NPOTTextures;
279
280     // Recognize features by minimum OpenGL version.
281     if (versions & QGLFormat::OpenGL_Version_1_2) {
282         features |= QGLFunctions::BlendColor |
283                     QGLFunctions::BlendEquation;
284     }
285     if (versions & QGLFormat::OpenGL_Version_1_3) {
286         features |= QGLFunctions::Multitexture |
287                     QGLFunctions::CompressedTextures |
288                     QGLFunctions::Multisample;
289     }
290     if (versions & QGLFormat::OpenGL_Version_1_4)
291         features |= QGLFunctions::BlendFuncSeparate;
292     if (versions & QGLFormat::OpenGL_Version_1_5)
293         features |= QGLFunctions::Buffers;
294     if (versions & QGLFormat::OpenGL_Version_2_0) {
295         features |= QGLFunctions::Shaders |
296                     QGLFunctions::StencilSeparate |
297                     QGLFunctions::BlendEquationSeparate |
298                     QGLFunctions::NPOTTextures;
299     }
300     return features;
301 #endif
302 }
303
304 /*!
305     Returns the set of features that are present on this system's
306     OpenGL implementation.
307
308     It is assumed that the QGLContext associated with this function
309     resolver is current.
310
311     \sa hasOpenGLFeature()
312 */
313 QGLFunctions::OpenGLFeatures QGLFunctions::openGLFeatures() const
314 {
315     QGLFunctionsPrivateEx *d = static_cast<QGLFunctionsPrivateEx *>(d_ptr);
316     if (!d)
317         return 0;
318     if (d->m_features == -1)
319         d->m_features = qt_gl_resolve_features();
320     return QGLFunctions::OpenGLFeatures(d->m_features);
321 }
322
323 /*!
324     Returns true if \a feature is present on this system's OpenGL
325     implementation; false otherwise.
326
327     It is assumed that the QGLContext associated with this function
328     resolver is current.
329
330     \sa openGLFeatures()
331 */
332 bool QGLFunctions::hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const
333 {
334     QGLFunctionsPrivateEx *d = static_cast<QGLFunctionsPrivateEx *>(d_ptr);
335     if (!d)
336         return false;
337     if (d->m_features == -1)
338         d->m_features = qt_gl_resolve_features();
339     return (d->m_features & int(feature)) != 0;
340 }
341
342 /*!
343     Initializes GL function resolution for \a context.  If \a context
344     is null, then the current QGLContext will be used.
345
346     After calling this function, the QGLFunctions object can only be
347     used with \a context and other contexts that share with it.
348     Call initializeGLFunctions() again to change the object's context
349     association.
350 */
351 void QGLFunctions::initializeGLFunctions(const QGLContext *context)
352 {
353     d_ptr = qt_gl_functions(context);
354 }
355
356 /*!
357     \fn void QGLFunctions::glActiveTexture(GLenum texture)
358
359     Convenience function that calls glActiveTexture(\a texture).
360
361     For more information, see the OpenGL/ES 2.0 documentation for
362     \l{http://www.khronos.org/opengles/sdk/docs/man/glActiveTexture.xml}{glActiveTexture()}.
363 */
364
365 /*!
366     \fn void QGLFunctions::glAttachShader(GLuint program, GLuint shader)
367
368     Convenience function that calls glAttachShader(\a program, \a shader).
369
370     For more information, see the OpenGL/ES 2.0 documentation for
371     \l{http://www.khronos.org/opengles/sdk/docs/man/glAttachShader.xml}{glAttachShader()}.
372
373     This convenience function will do nothing on OpenGL/ES 1.x systems.
374 */
375
376 /*!
377     \fn void QGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name)
378
379     Convenience function that calls glBindAttribLocation(\a program, \a index, \a name).
380
381     For more information, see the OpenGL/ES 2.0 documentation for
382     \l{http://www.khronos.org/opengles/sdk/docs/man/glBindAttribLocation.xml}{glBindAttribLocation()}.
383
384     This convenience function will do nothing on OpenGL/ES 1.x systems.
385 */
386
387 /*!
388     \fn void QGLFunctions::glBindBuffer(GLenum target, GLuint buffer)
389
390     Convenience function that calls glBindBuffer(\a target, \a buffer).
391
392     For more information, see the OpenGL/ES 2.0 documentation for
393     \l{http://www.khronos.org/opengles/sdk/docs/man/glBindBuffer.xml}{glBindBuffer()}.
394 */
395
396 /*!
397     \fn void QGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer)
398
399     Convenience function that calls glBindFramebuffer(\a target, \a framebuffer).
400
401     Note that Qt will translate a \a framebuffer argument of 0 to the currently
402     bound QOpenGLContext's defaultFramebufferObject().
403
404     For more information, see the OpenGL/ES 2.0 documentation for
405     \l{http://www.khronos.org/opengles/sdk/docs/man/glBindFramebuffer.xml}{glBindFramebuffer()}.
406 */
407
408 /*!
409     \fn void QGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
410
411     Convenience function that calls glBindRenderbuffer(\a target, \a renderbuffer).
412
413     For more information, see the OpenGL/ES 2.0 documentation for
414     \l{http://www.khronos.org/opengles/sdk/docs/man/glBindRenderbuffer.xml}{glBindRenderbuffer()}.
415 */
416
417 /*!
418     \fn void QGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
419
420     Convenience function that calls glBlendColor(\a red, \a green, \a blue, \a alpha).
421
422     For more information, see the OpenGL/ES 2.0 documentation for
423     \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendColor.xml}{glBlendColor()}.
424 */
425
426 /*!
427     \fn void QGLFunctions::glBlendEquation(GLenum mode)
428
429     Convenience function that calls glBlendEquation(\a mode).
430
431     For more information, see the OpenGL/ES 2.0 documentation for
432     \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquation.xml}{glBlendEquation()}.
433 */
434
435 /*!
436     \fn void QGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
437
438     Convenience function that calls glBlendEquationSeparate(\a modeRGB, \a modeAlpha).
439
440     For more information, see the OpenGL/ES 2.0 documentation for
441     \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquationSeparate.xml}{glBlendEquationSeparate()}.
442 */
443
444 /*!
445     \fn void QGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
446
447     Convenience function that calls glBlendFuncSeparate(\a srcRGB, \a dstRGB, \a srcAlpha, \a dstAlpha).
448
449     For more information, see the OpenGL/ES 2.0 documentation for
450     \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendFuncSeparate.xml}{glBlendFuncSeparate()}.
451 */
452
453 /*!
454     \fn void QGLFunctions::glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage)
455
456     Convenience function that calls glBufferData(\a target, \a size, \a data, \a usage).
457
458     For more information, see the OpenGL/ES 2.0 documentation for
459     \l{http://www.khronos.org/opengles/sdk/docs/man/glBufferData.xml}{glBufferData()}.
460 */
461
462 /*!
463     \fn void QGLFunctions::glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data)
464
465     Convenience function that calls glBufferSubData(\a target, \a offset, \a size, \a data).
466
467     For more information, see the OpenGL/ES 2.0 documentation for
468     \l{http://www.khronos.org/opengles/sdk/docs/man/glBufferSubData.xml}{glBufferSubData()}.
469 */
470
471 /*!
472     \fn GLenum QGLFunctions::glCheckFramebufferStatus(GLenum target)
473
474     Convenience function that calls glCheckFramebufferStatus(\a target).
475
476     For more information, see the OpenGL/ES 2.0 documentation for
477     \l{http://www.khronos.org/opengles/sdk/docs/man/glCheckFramebufferStatus.xml}{glCheckFramebufferStatus()}.
478 */
479
480 /*!
481     \fn void QGLFunctions::glClearDepthf(GLclampf depth)
482
483     Convenience function that calls glClearDepth(\a depth) on
484     desktop OpenGL systems and glClearDepthf(\a depth) on
485     embedded OpenGL/ES systems.
486
487     For more information, see the OpenGL/ES 2.0 documentation for
488     \l{http://www.khronos.org/opengles/sdk/docs/man/glClearDepthf.xml}{glClearDepthf()}.
489 */
490
491 /*!
492     \fn void QGLFunctions::glCompileShader(GLuint shader)
493
494     Convenience function that calls glCompileShader(\a shader).
495
496     For more information, see the OpenGL/ES 2.0 documentation for
497     \l{http://www.khronos.org/opengles/sdk/docs/man/glCompileShader.xml}{glCompileShader()}.
498
499     This convenience function will do nothing on OpenGL/ES 1.x systems.
500 */
501
502 /*!
503     \fn void QGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
504
505     Convenience function that calls glCompressedTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a imageSize, \a data).
506
507     For more information, see the OpenGL/ES 2.0 documentation for
508     \l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexImage2D.xml}{glCompressedTexImage2D()}.
509 */
510
511 /*!
512     \fn void QGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
513
514     Convenience function that calls glCompressedTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a imageSize, \a data).
515
516     For more information, see the OpenGL/ES 2.0 documentation for
517     \l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexSubImage2D.xml}{glCompressedTexSubImage2D()}.
518 */
519
520 /*!
521     \fn GLuint QGLFunctions::glCreateProgram()
522
523     Convenience function that calls glCreateProgram().
524
525     For more information, see the OpenGL/ES 2.0 documentation for
526     \l{http://www.khronos.org/opengles/sdk/docs/man/glCreateProgram.xml}{glCreateProgram()}.
527
528     This convenience function will do nothing on OpenGL/ES 1.x systems.
529 */
530
531 /*!
532     \fn GLuint QGLFunctions::glCreateShader(GLenum type)
533
534     Convenience function that calls glCreateShader(\a type).
535
536     For more information, see the OpenGL/ES 2.0 documentation for
537     \l{http://www.khronos.org/opengles/sdk/docs/man/glCreateShader.xml}{glCreateShader()}.
538
539     This convenience function will do nothing on OpenGL/ES 1.x systems.
540 */
541
542 /*!
543     \fn void QGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
544
545     Convenience function that calls glDeleteBuffers(\a n, \a buffers).
546
547     For more information, see the OpenGL/ES 2.0 documentation for
548     \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteBuffers.xml}{glDeleteBuffers()}.
549 */
550
551 /*!
552     \fn void QGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
553
554     Convenience function that calls glDeleteFramebuffers(\a n, \a framebuffers).
555
556     For more information, see the OpenGL/ES 2.0 documentation for
557     \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteFramebuffers.xml}{glDeleteFramebuffers()}.
558 */
559
560 /*!
561     \fn void QGLFunctions::glDeleteProgram(GLuint program)
562
563     Convenience function that calls glDeleteProgram(\a program).
564
565     For more information, see the OpenGL/ES 2.0 documentation for
566     \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteProgram.xml}{glDeleteProgram()}.
567
568     This convenience function will do nothing on OpenGL/ES 1.x systems.
569 */
570
571 /*!
572     \fn void QGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
573
574     Convenience function that calls glDeleteRenderbuffers(\a n, \a renderbuffers).
575
576     For more information, see the OpenGL/ES 2.0 documentation for
577     \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteRenderbuffers.xml}{glDeleteRenderbuffers()}.
578 */
579
580 /*!
581     \fn void QGLFunctions::glDeleteShader(GLuint shader)
582
583     Convenience function that calls glDeleteShader(\a shader).
584
585     For more information, see the OpenGL/ES 2.0 documentation for
586     \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteShader.xml}{glDeleteShader()}.
587
588     This convenience function will do nothing on OpenGL/ES 1.x systems.
589 */
590
591 /*!
592     \fn void QGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
593
594     Convenience function that calls glDepthRange(\a zNear, \a zFar) on
595     desktop OpenGL systems and glDepthRangef(\a zNear, \a zFar) on
596     embedded OpenGL/ES systems.
597
598     For more information, see the OpenGL/ES 2.0 documentation for
599     \l{http://www.khronos.org/opengles/sdk/docs/man/glDepthRangef.xml}{glDepthRangef()}.
600 */
601
602 /*!
603     \fn void QGLFunctions::glDetachShader(GLuint program, GLuint shader)
604
605     Convenience function that calls glDetachShader(\a program, \a shader).
606
607     For more information, see the OpenGL/ES 2.0 documentation for
608     \l{http://www.khronos.org/opengles/sdk/docs/man/glDetachShader.xml}{glDetachShader()}.
609
610     This convenience function will do nothing on OpenGL/ES 1.x systems.
611 */
612
613 /*!
614     \fn void QGLFunctions::glDisableVertexAttribArray(GLuint index)
615
616     Convenience function that calls glDisableVertexAttribArray(\a index).
617
618     For more information, see the OpenGL/ES 2.0 documentation for
619     \l{http://www.khronos.org/opengles/sdk/docs/man/glDisableVertexAttribArray.xml}{glDisableVertexAttribArray()}.
620
621     This convenience function will do nothing on OpenGL/ES 1.x systems.
622 */
623
624 /*!
625     \fn void QGLFunctions::glEnableVertexAttribArray(GLuint index)
626
627     Convenience function that calls glEnableVertexAttribArray(\a index).
628
629     For more information, see the OpenGL/ES 2.0 documentation for
630     \l{http://www.khronos.org/opengles/sdk/docs/man/glEnableVertexAttribArray.xml}{glEnableVertexAttribArray()}.
631
632     This convenience function will do nothing on OpenGL/ES 1.x systems.
633 */
634
635 /*!
636     \fn void QGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
637
638     Convenience function that calls glFramebufferRenderbuffer(\a target, \a attachment, \a renderbuffertarget, \a renderbuffer).
639
640     For more information, see the OpenGL/ES 2.0 documentation for
641     \l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferRenderbuffer.xml}{glFramebufferRenderbuffer()}.
642 */
643
644 /*!
645     \fn void QGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
646
647     Convenience function that calls glFramebufferTexture2D(\a target, \a attachment, \a textarget, \a texture, \a level).
648
649     For more information, see the OpenGL/ES 2.0 documentation for
650     \l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferTexture2D.xml}{glFramebufferTexture2D()}.
651 */
652
653 /*!
654     \fn void QGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
655
656     Convenience function that calls glGenBuffers(\a n, \a buffers).
657
658     For more information, see the OpenGL/ES 2.0 documentation for
659     \l{http://www.khronos.org/opengles/sdk/docs/man/glGenBuffers.xml}{glGenBuffers()}.
660 */
661
662 /*!
663     \fn void QGLFunctions::glGenerateMipmap(GLenum target)
664
665     Convenience function that calls glGenerateMipmap(\a target).
666
667     For more information, see the OpenGL/ES 2.0 documentation for
668     \l{http://www.khronos.org/opengles/sdk/docs/man/glGenerateMipmap.xml}{glGenerateMipmap()}.
669 */
670
671 /*!
672     \fn void QGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
673
674     Convenience function that calls glGenFramebuffers(\a n, \a framebuffers).
675
676     For more information, see the OpenGL/ES 2.0 documentation for
677     \l{http://www.khronos.org/opengles/sdk/docs/man/glGenFramebuffers.xml}{glGenFramebuffers()}.
678 */
679
680 /*!
681     \fn void QGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
682
683     Convenience function that calls glGenRenderbuffers(\a n, \a renderbuffers).
684
685     For more information, see the OpenGL/ES 2.0 documentation for
686     \l{http://www.khronos.org/opengles/sdk/docs/man/glGenRenderbuffers.xml}{glGenRenderbuffers()}.
687 */
688
689 /*!
690     \fn void QGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
691
692     Convenience function that calls glGetActiveAttrib(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).
693
694     For more information, see the OpenGL/ES 2.0 documentation for
695     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveAttrib.xml}{glGetActiveAttrib()}.
696
697     This convenience function will do nothing on OpenGL/ES 1.x systems.
698 */
699
700 /*!
701     \fn void QGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
702
703     Convenience function that calls glGetActiveUniform(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).
704
705     For more information, see the OpenGL/ES 2.0 documentation for
706     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveUniform.xml}{glGetActiveUniform()}.
707
708     This convenience function will do nothing on OpenGL/ES 1.x systems.
709 */
710
711 /*!
712     \fn void QGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
713
714     Convenience function that calls glGetAttachedShaders(\a program, \a maxcount, \a count, \a shaders).
715
716     For more information, see the OpenGL/ES 2.0 documentation for
717     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttachedShaders.xml}{glGetAttachedShaders()}.
718
719     This convenience function will do nothing on OpenGL/ES 1.x systems.
720 */
721
722 /*!
723     \fn int QGLFunctions::glGetAttribLocation(GLuint program, const char* name)
724
725     Convenience function that calls glGetAttribLocation(\a program, \a name).
726
727     For more information, see the OpenGL/ES 2.0 documentation for
728     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttribLocation.xml}{glGetAttribLocation()}.
729
730     This convenience function will do nothing on OpenGL/ES 1.x systems.
731 */
732
733 /*!
734     \fn void QGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
735
736     Convenience function that calls glGetBufferParameteriv(\a target, \a pname, \a params).
737
738     For more information, see the OpenGL/ES 2.0 documentation for
739     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetBufferParameteriv.xml}{glGetBufferParameteriv()}.
740 */
741
742 /*!
743     \fn void QGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
744
745     Convenience function that calls glGetFramebufferAttachmentParameteriv(\a target, \a attachment, \a pname, \a params).
746
747     For more information, see the OpenGL/ES 2.0 documentation for
748     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetFramebufferAttachmentParameteriv.xml}{glGetFramebufferAttachmentParameteriv()}.
749 */
750
751 /*!
752     \fn void QGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params)
753
754     Convenience function that calls glGetProgramiv(\a program, \a pname, \a params).
755
756     For more information, see the OpenGL/ES 2.0 documentation for
757     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramiv.xml}{glGetProgramiv()}.
758
759     This convenience function will do nothing on OpenGL/ES 1.x systems.
760 */
761
762 /*!
763     \fn void QGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
764
765     Convenience function that calls glGetProgramInfoLog(\a program, \a bufsize, \a length, \a infolog).
766
767     For more information, see the OpenGL/ES 2.0 documentation for
768     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramInfoLog.xml}{glGetProgramInfoLog()}.
769
770     This convenience function will do nothing on OpenGL/ES 1.x systems.
771 */
772
773 /*!
774     \fn void QGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
775
776     Convenience function that calls glGetRenderbufferParameteriv(\a target, \a pname, \a params).
777
778     For more information, see the OpenGL/ES 2.0 documentation for
779     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetRenderbufferParameteriv.xml}{glGetRenderbufferParameteriv()}.
780 */
781
782 /*!
783     \fn void QGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
784
785     Convenience function that calls glGetShaderiv(\a shader, \a pname, \a params).
786
787     For more information, see the OpenGL/ES 2.0 documentation for
788     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderiv.xml}{glGetShaderiv()}.
789
790     This convenience function will do nothing on OpenGL/ES 1.x systems.
791 */
792
793 /*!
794     \fn void QGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
795
796     Convenience function that calls glGetShaderInfoLog(\a shader, \a bufsize, \a length, \a infolog).
797
798     For more information, see the OpenGL/ES 2.0 documentation for
799     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderInfoLog.xml}{glGetShaderInfoLog()}.
800
801     This convenience function will do nothing on OpenGL/ES 1.x systems.
802 */
803
804 /*!
805     \fn void QGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
806
807     Convenience function that calls glGetShaderPrecisionFormat(\a shadertype, \a precisiontype, \a range, \a precision).
808
809     For more information, see the OpenGL/ES 2.0 documentation for
810     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderPrecisionFormat.xml}{glGetShaderPrecisionFormat()}.
811
812     This convenience function will do nothing on OpenGL/ES 1.x systems.
813 */
814
815 /*!
816     \fn void QGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
817
818     Convenience function that calls glGetShaderSource(\a shader, \a bufsize, \a length, \a source).
819
820     For more information, see the OpenGL/ES 2.0 documentation for
821     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderSource.xml}{glGetShaderSource()}.
822
823     This convenience function will do nothing on OpenGL/ES 1.x systems.
824 */
825
826 /*!
827     \fn void QGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params)
828
829     Convenience function that calls glGetUniformfv(\a program, \a location, \a params).
830
831     For more information, see the OpenGL/ES 2.0 documentation for
832     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformfv.xml}{glGetUniformfv()}.
833
834     This convenience function will do nothing on OpenGL/ES 1.x systems.
835 */
836
837 /*!
838     \fn void QGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params)
839
840     Convenience function that calls glGetUniformiv(\a program, \a location, \a params).
841
842     For more information, see the OpenGL/ES 2.0 documentation for
843     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformiv.xml}{glGetUniformiv()}.
844
845     This convenience function will do nothing on OpenGL/ES 1.x systems.
846 */
847
848 /*!
849     \fn int QGLFunctions::glGetUniformLocation(GLuint program, const char* name)
850
851     Convenience function that calls glGetUniformLocation(\a program, \a name).
852
853     For more information, see the OpenGL/ES 2.0 documentation for
854     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformLocation.xml}{glGetUniformLocation()}.
855
856     This convenience function will do nothing on OpenGL/ES 1.x systems.
857 */
858
859 /*!
860     \fn void QGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
861
862     Convenience function that calls glGetVertexAttribfv(\a index, \a pname, \a params).
863
864     For more information, see the OpenGL/ES 2.0 documentation for
865     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribfv.xml}{glGetVertexAttribfv()}.
866
867     This convenience function will do nothing on OpenGL/ES 1.x systems.
868 */
869
870 /*!
871     \fn void QGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
872
873     Convenience function that calls glGetVertexAttribiv(\a index, \a pname, \a params).
874
875     For more information, see the OpenGL/ES 2.0 documentation for
876     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribiv.xml}{glGetVertexAttribiv()}.
877
878     This convenience function will do nothing on OpenGL/ES 1.x systems.
879 */
880
881 /*!
882     \fn void QGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
883
884     Convenience function that calls glGetVertexAttribPointerv(\a index, \a pname, \a pointer).
885
886     For more information, see the OpenGL/ES 2.0 documentation for
887     \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribPointerv.xml}{glGetVertexAttribPointerv()}.
888
889     This convenience function will do nothing on OpenGL/ES 1.x systems.
890 */
891
892 /*!
893     \fn GLboolean QGLFunctions::glIsBuffer(GLuint buffer)
894
895     Convenience function that calls glIsBuffer(\a buffer).
896
897     For more information, see the OpenGL/ES 2.0 documentation for
898     \l{http://www.khronos.org/opengles/sdk/docs/man/glIsBuffer.xml}{glIsBuffer()}.
899 */
900
901 /*!
902     \fn GLboolean QGLFunctions::glIsFramebuffer(GLuint framebuffer)
903
904     Convenience function that calls glIsFramebuffer(\a framebuffer).
905
906     For more information, see the OpenGL/ES 2.0 documentation for
907     \l{http://www.khronos.org/opengles/sdk/docs/man/glIsFramebuffer.xml}{glIsFramebuffer()}.
908 */
909
910 /*!
911     \fn GLboolean QGLFunctions::glIsProgram(GLuint program)
912
913     Convenience function that calls glIsProgram(\a program).
914
915     For more information, see the OpenGL/ES 2.0 documentation for
916     \l{http://www.khronos.org/opengles/sdk/docs/man/glIsProgram.xml}{glIsProgram()}.
917
918     This convenience function will do nothing on OpenGL/ES 1.x systems.
919 */
920
921 /*!
922     \fn GLboolean QGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
923
924     Convenience function that calls glIsRenderbuffer(\a renderbuffer).
925
926     For more information, see the OpenGL/ES 2.0 documentation for
927     \l{http://www.khronos.org/opengles/sdk/docs/man/glIsRenderbuffer.xml}{glIsRenderbuffer()}.
928 */
929
930 /*!
931     \fn GLboolean QGLFunctions::glIsShader(GLuint shader)
932
933     Convenience function that calls glIsShader(\a shader).
934
935     For more information, see the OpenGL/ES 2.0 documentation for
936     \l{http://www.khronos.org/opengles/sdk/docs/man/glIsShader.xml}{glIsShader()}.
937
938     This convenience function will do nothing on OpenGL/ES 1.x systems.
939 */
940
941 /*!
942     \fn void QGLFunctions::glLinkProgram(GLuint program)
943
944     Convenience function that calls glLinkProgram(\a program).
945
946     For more information, see the OpenGL/ES 2.0 documentation for
947     \l{http://www.khronos.org/opengles/sdk/docs/man/glLinkProgram.xml}{glLinkProgram()}.
948
949     This convenience function will do nothing on OpenGL/ES 1.x systems.
950 */
951
952 /*!
953     \fn void QGLFunctions::glReleaseShaderCompiler()
954
955     Convenience function that calls glReleaseShaderCompiler().
956
957     For more information, see the OpenGL/ES 2.0 documentation for
958     \l{http://www.khronos.org/opengles/sdk/docs/man/glReleaseShaderCompiler.xml}{glReleaseShaderCompiler()}.
959
960     This convenience function will do nothing on OpenGL/ES 1.x systems.
961 */
962
963 /*!
964     \fn void QGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
965
966     Convenience function that calls glRenderbufferStorage(\a target, \a internalformat, \a width, \a height).
967
968     For more information, see the OpenGL/ES 2.0 documentation for
969     \l{http://www.khronos.org/opengles/sdk/docs/man/glRenderbufferStorage.xml}{glRenderbufferStorage()}.
970 */
971
972 /*!
973     \fn void QGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
974
975     Convenience function that calls glSampleCoverage(\a value, \a invert).
976
977     For more information, see the OpenGL/ES 2.0 documentation for
978     \l{http://www.khronos.org/opengles/sdk/docs/man/glSampleCoverage.xml}{glSampleCoverage()}.
979 */
980
981 /*!
982     \fn void QGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
983
984     Convenience function that calls glShaderBinary(\a n, \a shaders, \a binaryformat, \a binary, \a length).
985
986     For more information, see the OpenGL/ES 2.0 documentation for
987     \l{http://www.khronos.org/opengles/sdk/docs/man/glShaderBinary.xml}{glShaderBinary()}.
988
989     This convenience function will do nothing on OpenGL/ES 1.x systems.
990 */
991
992 /*!
993     \fn void QGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
994
995     Convenience function that calls glShaderSource(\a shader, \a count, \a string, \a length).
996
997     For more information, see the OpenGL/ES 2.0 documentation for
998     \l{http://www.khronos.org/opengles/sdk/docs/man/glShaderSource.xml}{glShaderSource()}.
999
1000     This convenience function will do nothing on OpenGL/ES 1.x systems.
1001 */
1002
1003 /*!
1004     \fn void QGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
1005
1006     Convenience function that calls glStencilFuncSeparate(\a face, \a func, \a ref, \a mask).
1007
1008     For more information, see the OpenGL/ES 2.0 documentation for
1009     \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilFuncSeparate.xml}{glStencilFuncSeparate()}.
1010 */
1011
1012 /*!
1013     \fn void QGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
1014
1015     Convenience function that calls glStencilMaskSeparate(\a face, \a mask).
1016
1017     For more information, see the OpenGL/ES 2.0 documentation for
1018     \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilMaskSeparate.xml}{glStencilMaskSeparate()}.
1019 */
1020
1021 /*!
1022     \fn void QGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
1023
1024     Convenience function that calls glStencilOpSeparate(\a face, \a fail, \a zfail, \a zpass).
1025
1026     For more information, see the OpenGL/ES 2.0 documentation for
1027     \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilOpSeparate.xml}{glStencilOpSeparate()}.
1028 */
1029
1030 /*!
1031     \fn void QGLFunctions::glUniform1f(GLint location, GLfloat x)
1032
1033     Convenience function that calls glUniform1f(\a location, \a x).
1034
1035     For more information, see the OpenGL/ES 2.0 documentation for
1036     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1f.xml}{glUniform1f()}.
1037
1038     This convenience function will do nothing on OpenGL/ES 1.x systems.
1039 */
1040
1041 /*!
1042     \fn void QGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
1043
1044     Convenience function that calls glUniform1fv(\a location, \a count, \a v).
1045
1046     For more information, see the OpenGL/ES 2.0 documentation for
1047     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1fv.xml}{glUniform1fv()}.
1048
1049     This convenience function will do nothing on OpenGL/ES 1.x systems.
1050 */
1051
1052 /*!
1053     \fn void QGLFunctions::glUniform1i(GLint location, GLint x)
1054
1055     Convenience function that calls glUniform1i(\a location, \a x).
1056
1057     For more information, see the OpenGL/ES 2.0 documentation for
1058     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1i.xml}{glUniform1i()}.
1059
1060     This convenience function will do nothing on OpenGL/ES 1.x systems.
1061 */
1062
1063 /*!
1064     \fn void QGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v)
1065
1066     Convenience function that calls glUniform1iv(\a location, \a count, \a v).
1067
1068     For more information, see the OpenGL/ES 2.0 documentation for
1069     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1iv.xml}{glUniform1iv()}.
1070
1071     This convenience function will do nothing on OpenGL/ES 1.x systems.
1072 */
1073
1074 /*!
1075     \fn void QGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
1076
1077     Convenience function that calls glUniform2f(\a location, \a x, \a y).
1078
1079     For more information, see the OpenGL/ES 2.0 documentation for
1080     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2f.xml}{glUniform2f()}.
1081
1082     This convenience function will do nothing on OpenGL/ES 1.x systems.
1083 */
1084
1085 /*!
1086     \fn void QGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
1087
1088     Convenience function that calls glUniform2fv(\a location, \a count, \a v).
1089
1090     For more information, see the OpenGL/ES 2.0 documentation for
1091     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2fv.xml}{glUniform2fv()}.
1092
1093     This convenience function will do nothing on OpenGL/ES 1.x systems.
1094 */
1095
1096 /*!
1097     \fn void QGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
1098
1099     Convenience function that calls glUniform2i(\a location, \a x, \a y).
1100
1101     For more information, see the OpenGL/ES 2.0 documentation for
1102     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2i.xml}{glUniform2i()}.
1103
1104     This convenience function will do nothing on OpenGL/ES 1.x systems.
1105 */
1106
1107 /*!
1108     \fn void QGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v)
1109
1110     Convenience function that calls glUniform2iv(\a location, \a count, \a v).
1111
1112     For more information, see the OpenGL/ES 2.0 documentation for
1113     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2iv.xml}{glUniform2iv()}.
1114
1115     This convenience function will do nothing on OpenGL/ES 1.x systems.
1116 */
1117
1118 /*!
1119     \fn void QGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
1120
1121     Convenience function that calls glUniform3f(\a location, \a x, \a y, \a z).
1122
1123     For more information, see the OpenGL/ES 2.0 documentation for
1124     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3f.xml}{glUniform3f()}.
1125
1126     This convenience function will do nothing on OpenGL/ES 1.x systems.
1127 */
1128
1129 /*!
1130     \fn void QGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
1131
1132     Convenience function that calls glUniform3fv(\a location, \a count, \a v).
1133
1134     For more information, see the OpenGL/ES 2.0 documentation for
1135     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3fv.xml}{glUniform3fv()}.
1136
1137     This convenience function will do nothing on OpenGL/ES 1.x systems.
1138 */
1139
1140 /*!
1141     \fn void QGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z)
1142
1143     Convenience function that calls glUniform3i(\a location, \a x, \a y, \a z).
1144
1145     For more information, see the OpenGL/ES 2.0 documentation for
1146     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3i.xml}{glUniform3i()}.
1147
1148     This convenience function will do nothing on OpenGL/ES 1.x systems.
1149 */
1150
1151 /*!
1152     \fn void QGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v)
1153
1154     Convenience function that calls glUniform3iv(\a location, \a count, \a v).
1155
1156     For more information, see the OpenGL/ES 2.0 documentation for
1157     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3iv.xml}{glUniform3iv()}.
1158
1159     This convenience function will do nothing on OpenGL/ES 1.x systems.
1160 */
1161
1162 /*!
1163     \fn void QGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1164
1165     Convenience function that calls glUniform4f(\a location, \a x, \a y, \a z, \a w).
1166
1167     For more information, see the OpenGL/ES 2.0 documentation for
1168     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4f.xml}{glUniform4f()}.
1169
1170     This convenience function will do nothing on OpenGL/ES 1.x systems.
1171 */
1172
1173 /*!
1174     \fn void QGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
1175
1176     Convenience function that calls glUniform4fv(\a location, \a count, \a v).
1177
1178     For more information, see the OpenGL/ES 2.0 documentation for
1179     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4fv.xml}{glUniform4fv()}.
1180
1181     This convenience function will do nothing on OpenGL/ES 1.x systems.
1182 */
1183
1184 /*!
1185     \fn void QGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
1186
1187     Convenience function that calls glUniform4i(\a location, \a x, \a y, \a z, \a w).
1188
1189     For more information, see the OpenGL/ES 2.0 documentation for
1190     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4i.xml}{glUniform4i()}.
1191
1192     This convenience function will do nothing on OpenGL/ES 1.x systems.
1193 */
1194
1195 /*!
1196     \fn void QGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v)
1197
1198     Convenience function that calls glUniform4iv(\a location, \a count, \a v).
1199
1200     For more information, see the OpenGL/ES 2.0 documentation for
1201     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4iv.xml}{glUniform4iv()}.
1202
1203     This convenience function will do nothing on OpenGL/ES 1.x systems.
1204 */
1205
1206 /*!
1207     \fn void QGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1208
1209     Convenience function that calls glUniformMatrix2fv(\a location, \a count, \a transpose, \a value).
1210
1211     For more information, see the OpenGL/ES 2.0 documentation for
1212     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix2fv.xml}{glUniformMatrix2fv()}.
1213
1214     This convenience function will do nothing on OpenGL/ES 1.x systems.
1215 */
1216
1217 /*!
1218     \fn void QGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1219
1220     Convenience function that calls glUniformMatrix3fv(\a location, \a count, \a transpose, \a value).
1221
1222     For more information, see the OpenGL/ES 2.0 documentation for
1223     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix3fv.xml}{glUniformMatrix3fv()}.
1224
1225     This convenience function will do nothing on OpenGL/ES 1.x systems.
1226 */
1227
1228 /*!
1229     \fn void QGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1230
1231     Convenience function that calls glUniformMatrix4fv(\a location, \a count, \a transpose, \a value).
1232
1233     For more information, see the OpenGL/ES 2.0 documentation for
1234     \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix4fv.xml}{glUniformMatrix4fv()}.
1235
1236     This convenience function will do nothing on OpenGL/ES 1.x systems.
1237 */
1238
1239 /*!
1240     \fn void QGLFunctions::glUseProgram(GLuint program)
1241
1242     Convenience function that calls glUseProgram(\a program).
1243
1244     For more information, see the OpenGL/ES 2.0 documentation for
1245     \l{http://www.khronos.org/opengles/sdk/docs/man/glUseProgram.xml}{glUseProgram()}.
1246
1247     This convenience function will do nothing on OpenGL/ES 1.x systems.
1248 */
1249
1250 /*!
1251     \fn void QGLFunctions::glValidateProgram(GLuint program)
1252
1253     Convenience function that calls glValidateProgram(\a program).
1254
1255     For more information, see the OpenGL/ES 2.0 documentation for
1256     \l{http://www.khronos.org/opengles/sdk/docs/man/glValidateProgram.xml}{glValidateProgram()}.
1257
1258     This convenience function will do nothing on OpenGL/ES 1.x systems.
1259 */
1260
1261 /*!
1262     \fn void QGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
1263
1264     Convenience function that calls glVertexAttrib1f(\a indx, \a x).
1265
1266     For more information, see the OpenGL/ES 2.0 documentation for
1267     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1f.xml}{glVertexAttrib1f()}.
1268
1269     This convenience function will do nothing on OpenGL/ES 1.x systems.
1270 */
1271
1272 /*!
1273     \fn void QGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values)
1274
1275     Convenience function that calls glVertexAttrib1fv(\a indx, \a values).
1276
1277     For more information, see the OpenGL/ES 2.0 documentation for
1278     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1fv.xml}{glVertexAttrib1fv()}.
1279
1280     This convenience function will do nothing on OpenGL/ES 1.x systems.
1281 */
1282
1283 /*!
1284     \fn void QGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
1285
1286     Convenience function that calls glVertexAttrib2f(\a indx, \a x, \a y).
1287
1288     For more information, see the OpenGL/ES 2.0 documentation for
1289     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2f.xml}{glVertexAttrib2f()}.
1290
1291     This convenience function will do nothing on OpenGL/ES 1.x systems.
1292 */
1293
1294 /*!
1295     \fn void QGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values)
1296
1297     Convenience function that calls glVertexAttrib2fv(\a indx, \a values).
1298
1299     For more information, see the OpenGL/ES 2.0 documentation for
1300     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2fv.xml}{glVertexAttrib2fv()}.
1301
1302     This convenience function will do nothing on OpenGL/ES 1.x systems.
1303 */
1304
1305 /*!
1306     \fn void QGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
1307
1308     Convenience function that calls glVertexAttrib3f(\a indx, \a x, \a y, \a z).
1309
1310     For more information, see the OpenGL/ES 2.0 documentation for
1311     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3f.xml}{glVertexAttrib3f()}.
1312
1313     This convenience function will do nothing on OpenGL/ES 1.x systems.
1314 */
1315
1316 /*!
1317     \fn void QGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values)
1318
1319     Convenience function that calls glVertexAttrib3fv(\a indx, \a values).
1320
1321     For more information, see the OpenGL/ES 2.0 documentation for
1322     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3fv.xml}{glVertexAttrib3fv()}.
1323
1324     This convenience function will do nothing on OpenGL/ES 1.x systems.
1325 */
1326
1327 /*!
1328     \fn void QGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1329
1330     Convenience function that calls glVertexAttrib4f(\a indx, \a x, \a y, \a z, \a w).
1331
1332     For more information, see the OpenGL/ES 2.0 documentation for
1333     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4f.xml}{glVertexAttrib4f()}.
1334
1335     This convenience function will do nothing on OpenGL/ES 1.x systems.
1336 */
1337
1338 /*!
1339     \fn void QGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values)
1340
1341     Convenience function that calls glVertexAttrib4fv(\a indx, \a values).
1342
1343     For more information, see the OpenGL/ES 2.0 documentation for
1344     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4fv.xml}{glVertexAttrib4fv()}.
1345
1346     This convenience function will do nothing on OpenGL/ES 1.x systems.
1347 */
1348
1349 /*!
1350     \fn void QGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
1351
1352     Convenience function that calls glVertexAttribPointer(\a indx, \a size, \a type, \a normalized, \a stride, \a ptr).
1353
1354     For more information, see the OpenGL/ES 2.0 documentation for
1355     \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttribPointer.xml}{glVertexAttribPointer()}.
1356
1357     This convenience function will do nothing on OpenGL/ES 1.x systems.
1358 */
1359
1360 #ifndef QT_OPENGL_ES_2
1361
1362 static void QGLF_APIENTRY qglfResolveActiveTexture(GLenum texture)
1363 {
1364     typedef void (QGLF_APIENTRYP type_glActiveTexture)(GLenum texture);
1365
1366     const QGLContext *context = QGLContext::currentContext();
1367     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1368
1369     funcs->activeTexture = (type_glActiveTexture)
1370         context->getProcAddress(QLatin1String("glActiveTexture"));
1371     if (!funcs->activeTexture) {
1372         funcs->activeTexture = (type_glActiveTexture)
1373             context->getProcAddress(QLatin1String("glActiveTextureARB"));
1374     }
1375
1376     if (funcs->activeTexture)
1377         funcs->activeTexture(texture);
1378     else
1379         funcs->activeTexture = qglfResolveActiveTexture;
1380 }
1381
1382 static void QGLF_APIENTRY qglfResolveAttachShader(GLuint program, GLuint shader)
1383 {
1384     typedef void (QGLF_APIENTRYP type_glAttachShader)(GLuint program, GLuint shader);
1385
1386     const QGLContext *context = QGLContext::currentContext();
1387     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1388
1389     funcs->attachShader = (type_glAttachShader)
1390         context->getProcAddress(QLatin1String("glAttachShader"));
1391     if (!funcs->attachShader) {
1392         funcs->attachShader = (type_glAttachShader)
1393             context->getProcAddress(QLatin1String("glAttachObjectARB"));
1394     }
1395
1396     if (funcs->attachShader)
1397         funcs->attachShader(program, shader);
1398     else
1399         funcs->attachShader = qglfResolveAttachShader;
1400 }
1401
1402 static void QGLF_APIENTRY qglfResolveBindAttribLocation(GLuint program, GLuint index, const char* name)
1403 {
1404     typedef void (QGLF_APIENTRYP type_glBindAttribLocation)(GLuint program, GLuint index, const char* name);
1405
1406     const QGLContext *context = QGLContext::currentContext();
1407     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1408
1409     funcs->bindAttribLocation = (type_glBindAttribLocation)
1410         context->getProcAddress(QLatin1String("glBindAttribLocation"));
1411     if (!funcs->bindAttribLocation) {
1412         funcs->bindAttribLocation = (type_glBindAttribLocation)
1413             context->getProcAddress(QLatin1String("glBindAttribLocationARB"));
1414     }
1415
1416     if (funcs->bindAttribLocation)
1417         funcs->bindAttribLocation(program, index, name);
1418     else
1419         funcs->bindAttribLocation = qglfResolveBindAttribLocation;
1420 }
1421
1422 static void QGLF_APIENTRY qglfResolveBindBuffer(GLenum target, GLuint buffer)
1423 {
1424     typedef void (QGLF_APIENTRYP type_glBindBuffer)(GLenum target, GLuint buffer);
1425
1426     const QGLContext *context = QGLContext::currentContext();
1427     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1428
1429     funcs->bindBuffer = (type_glBindBuffer)
1430         context->getProcAddress(QLatin1String("glBindBuffer"));
1431 #ifdef QT_OPENGL_ES
1432     if (!funcs->bindBuffer) {
1433         funcs->bindBuffer = (type_glBindBuffer)
1434             context->getProcAddress(QLatin1String("glBindBufferOES"));
1435     }
1436 #endif
1437     if (!funcs->bindBuffer) {
1438         funcs->bindBuffer = (type_glBindBuffer)
1439             context->getProcAddress(QLatin1String("glBindBufferEXT"));
1440     }
1441     if (!funcs->bindBuffer) {
1442         funcs->bindBuffer = (type_glBindBuffer)
1443             context->getProcAddress(QLatin1String("glBindBufferARB"));
1444     }
1445
1446     if (funcs->bindBuffer)
1447         funcs->bindBuffer(target, buffer);
1448     else
1449         funcs->bindBuffer = qglfResolveBindBuffer;
1450 }
1451
1452 static void QGLF_APIENTRY qglfResolveBindFramebuffer(GLenum target, GLuint framebuffer)
1453 {
1454     typedef void (QGLF_APIENTRYP type_glBindFramebuffer)(GLenum target, GLuint framebuffer);
1455
1456     const QGLContext *context = QGLContext::currentContext();
1457     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1458
1459     funcs->bindFramebuffer = (type_glBindFramebuffer)
1460         context->getProcAddress(QLatin1String("glBindFramebuffer"));
1461 #ifdef QT_OPENGL_ES
1462     if (!funcs->bindFramebuffer) {
1463         funcs->bindFramebuffer = (type_glBindFramebuffer)
1464             context->getProcAddress(QLatin1String("glBindFramebufferOES"));
1465     }
1466 #endif
1467     if (!funcs->bindFramebuffer) {
1468         funcs->bindFramebuffer = (type_glBindFramebuffer)
1469             context->getProcAddress(QLatin1String("glBindFramebufferEXT"));
1470     }
1471     if (!funcs->bindFramebuffer) {
1472         funcs->bindFramebuffer = (type_glBindFramebuffer)
1473             context->getProcAddress(QLatin1String("glBindFramebufferARB"));
1474     }
1475
1476     if (funcs->bindFramebuffer)
1477         funcs->bindFramebuffer(target, framebuffer);
1478     else
1479         funcs->bindFramebuffer = qglfResolveBindFramebuffer;
1480 }
1481
1482 static void QGLF_APIENTRY qglfResolveBindRenderbuffer(GLenum target, GLuint renderbuffer)
1483 {
1484     typedef void (QGLF_APIENTRYP type_glBindRenderbuffer)(GLenum target, GLuint renderbuffer);
1485
1486     const QGLContext *context = QGLContext::currentContext();
1487     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1488
1489     funcs->bindRenderbuffer = (type_glBindRenderbuffer)
1490         context->getProcAddress(QLatin1String("glBindRenderbuffer"));
1491 #ifdef QT_OPENGL_ES
1492     if (!funcs->bindRenderbuffer) {
1493         funcs->bindRenderbuffer = (type_glBindRenderbuffer)
1494             context->getProcAddress(QLatin1String("glBindRenderbufferOES"));
1495     }
1496 #endif
1497     if (!funcs->bindRenderbuffer) {
1498         funcs->bindRenderbuffer = (type_glBindRenderbuffer)
1499             context->getProcAddress(QLatin1String("glBindRenderbufferEXT"));
1500     }
1501     if (!funcs->bindRenderbuffer) {
1502         funcs->bindRenderbuffer = (type_glBindRenderbuffer)
1503             context->getProcAddress(QLatin1String("glBindRenderbufferARB"));
1504     }
1505
1506     if (funcs->bindRenderbuffer)
1507         funcs->bindRenderbuffer(target, renderbuffer);
1508     else
1509         funcs->bindRenderbuffer = qglfResolveBindRenderbuffer;
1510 }
1511
1512 static void QGLF_APIENTRY qglfResolveBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
1513 {
1514     typedef void (QGLF_APIENTRYP type_glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
1515
1516     const QGLContext *context = QGLContext::currentContext();
1517     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1518
1519     funcs->blendColor = (type_glBlendColor)
1520         context->getProcAddress(QLatin1String("glBlendColor"));
1521 #ifdef QT_OPENGL_ES
1522     if (!funcs->blendColor) {
1523         funcs->blendColor = (type_glBlendColor)
1524             context->getProcAddress(QLatin1String("glBlendColorOES"));
1525     }
1526 #endif
1527     if (!funcs->blendColor) {
1528         funcs->blendColor = (type_glBlendColor)
1529             context->getProcAddress(QLatin1String("glBlendColorEXT"));
1530     }
1531     if (!funcs->blendColor) {
1532         funcs->blendColor = (type_glBlendColor)
1533             context->getProcAddress(QLatin1String("glBlendColorARB"));
1534     }
1535
1536     if (funcs->blendColor)
1537         funcs->blendColor(red, green, blue, alpha);
1538     else
1539         funcs->blendColor = qglfResolveBlendColor;
1540 }
1541
1542 static void QGLF_APIENTRY qglfResolveBlendEquation(GLenum mode)
1543 {
1544     typedef void (QGLF_APIENTRYP type_glBlendEquation)(GLenum mode);
1545
1546     const QGLContext *context = QGLContext::currentContext();
1547     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1548
1549     funcs->blendEquation = (type_glBlendEquation)
1550         context->getProcAddress(QLatin1String("glBlendEquation"));
1551 #ifdef QT_OPENGL_ES
1552     if (!funcs->blendEquation) {
1553         funcs->blendEquation = (type_glBlendEquation)
1554             context->getProcAddress(QLatin1String("glBlendEquationOES"));
1555     }
1556 #endif
1557     if (!funcs->blendEquation) {
1558         funcs->blendEquation = (type_glBlendEquation)
1559             context->getProcAddress(QLatin1String("glBlendEquationEXT"));
1560     }
1561     if (!funcs->blendEquation) {
1562         funcs->blendEquation = (type_glBlendEquation)
1563             context->getProcAddress(QLatin1String("glBlendEquationARB"));
1564     }
1565
1566     if (funcs->blendEquation)
1567         funcs->blendEquation(mode);
1568     else
1569         funcs->blendEquation = qglfResolveBlendEquation;
1570 }
1571
1572 static void QGLF_APIENTRY qglfResolveBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
1573 {
1574     typedef void (QGLF_APIENTRYP type_glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
1575
1576     const QGLContext *context = QGLContext::currentContext();
1577     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1578
1579     funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
1580         context->getProcAddress(QLatin1String("glBlendEquationSeparate"));
1581 #ifdef QT_OPENGL_ES
1582     if (!funcs->blendEquationSeparate) {
1583         funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
1584             context->getProcAddress(QLatin1String("glBlendEquationSeparateOES"));
1585     }
1586 #endif
1587     if (!funcs->blendEquationSeparate) {
1588         funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
1589             context->getProcAddress(QLatin1String("glBlendEquationSeparateEXT"));
1590     }
1591     if (!funcs->blendEquationSeparate) {
1592         funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
1593             context->getProcAddress(QLatin1String("glBlendEquationSeparateARB"));
1594     }
1595
1596     if (funcs->blendEquationSeparate)
1597         funcs->blendEquationSeparate(modeRGB, modeAlpha);
1598     else
1599         funcs->blendEquationSeparate = qglfResolveBlendEquationSeparate;
1600 }
1601
1602 static void QGLF_APIENTRY qglfResolveBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
1603 {
1604     typedef void (QGLF_APIENTRYP type_glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
1605
1606     const QGLContext *context = QGLContext::currentContext();
1607     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1608
1609     funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
1610         context->getProcAddress(QLatin1String("glBlendFuncSeparate"));
1611 #ifdef QT_OPENGL_ES
1612     if (!funcs->blendFuncSeparate) {
1613         funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
1614             context->getProcAddress(QLatin1String("glBlendFuncSeparateOES"));
1615     }
1616 #endif
1617     if (!funcs->blendFuncSeparate) {
1618         funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
1619             context->getProcAddress(QLatin1String("glBlendFuncSeparateEXT"));
1620     }
1621     if (!funcs->blendFuncSeparate) {
1622         funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
1623             context->getProcAddress(QLatin1String("glBlendFuncSeparateARB"));
1624     }
1625
1626     if (funcs->blendFuncSeparate)
1627         funcs->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
1628     else
1629         funcs->blendFuncSeparate = qglfResolveBlendFuncSeparate;
1630 }
1631
1632 static void QGLF_APIENTRY qglfResolveBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage)
1633 {
1634     typedef void (QGLF_APIENTRYP type_glBufferData)(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage);
1635
1636     const QGLContext *context = QGLContext::currentContext();
1637     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1638
1639     funcs->bufferData = (type_glBufferData)
1640         context->getProcAddress(QLatin1String("glBufferData"));
1641 #ifdef QT_OPENGL_ES
1642     if (!funcs->bufferData) {
1643         funcs->bufferData = (type_glBufferData)
1644             context->getProcAddress(QLatin1String("glBufferDataOES"));
1645     }
1646 #endif
1647     if (!funcs->bufferData) {
1648         funcs->bufferData = (type_glBufferData)
1649             context->getProcAddress(QLatin1String("glBufferDataEXT"));
1650     }
1651     if (!funcs->bufferData) {
1652         funcs->bufferData = (type_glBufferData)
1653             context->getProcAddress(QLatin1String("glBufferDataARB"));
1654     }
1655
1656     if (funcs->bufferData)
1657         funcs->bufferData(target, size, data, usage);
1658     else
1659         funcs->bufferData = qglfResolveBufferData;
1660 }
1661
1662 static void QGLF_APIENTRY qglfResolveBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data)
1663 {
1664     typedef void (QGLF_APIENTRYP type_glBufferSubData)(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data);
1665
1666     const QGLContext *context = QGLContext::currentContext();
1667     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1668
1669     funcs->bufferSubData = (type_glBufferSubData)
1670         context->getProcAddress(QLatin1String("glBufferSubData"));
1671 #ifdef QT_OPENGL_ES
1672     if (!funcs->bufferSubData) {
1673         funcs->bufferSubData = (type_glBufferSubData)
1674             context->getProcAddress(QLatin1String("glBufferSubDataOES"));
1675     }
1676 #endif
1677     if (!funcs->bufferSubData) {
1678         funcs->bufferSubData = (type_glBufferSubData)
1679             context->getProcAddress(QLatin1String("glBufferSubDataEXT"));
1680     }
1681     if (!funcs->bufferSubData) {
1682         funcs->bufferSubData = (type_glBufferSubData)
1683             context->getProcAddress(QLatin1String("glBufferSubDataARB"));
1684     }
1685
1686     if (funcs->bufferSubData)
1687         funcs->bufferSubData(target, offset, size, data);
1688     else
1689         funcs->bufferSubData = qglfResolveBufferSubData;
1690 }
1691
1692 static GLenum QGLF_APIENTRY qglfResolveCheckFramebufferStatus(GLenum target)
1693 {
1694     typedef GLenum (QGLF_APIENTRYP type_glCheckFramebufferStatus)(GLenum target);
1695
1696     const QGLContext *context = QGLContext::currentContext();
1697     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1698
1699     funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
1700         context->getProcAddress(QLatin1String("glCheckFramebufferStatus"));
1701 #ifdef QT_OPENGL_ES
1702     if (!funcs->checkFramebufferStatus) {
1703         funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
1704             context->getProcAddress(QLatin1String("glCheckFramebufferStatusOES"));
1705     }
1706 #endif
1707     if (!funcs->checkFramebufferStatus) {
1708         funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
1709             context->getProcAddress(QLatin1String("glCheckFramebufferStatusEXT"));
1710     }
1711     if (!funcs->checkFramebufferStatus) {
1712         funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
1713             context->getProcAddress(QLatin1String("glCheckFramebufferStatusARB"));
1714     }
1715
1716     if (funcs->checkFramebufferStatus)
1717         return funcs->checkFramebufferStatus(target);
1718     funcs->checkFramebufferStatus = qglfResolveCheckFramebufferStatus;
1719     return GLenum(0);
1720 }
1721
1722 static void QGLF_APIENTRY qglfResolveCompileShader(GLuint shader)
1723 {
1724     typedef void (QGLF_APIENTRYP type_glCompileShader)(GLuint shader);
1725
1726     const QGLContext *context = QGLContext::currentContext();
1727     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1728
1729     funcs->compileShader = (type_glCompileShader)
1730         context->getProcAddress(QLatin1String("glCompileShader"));
1731     if (!funcs->compileShader) {
1732         funcs->compileShader = (type_glCompileShader)
1733             context->getProcAddress(QLatin1String("glCompileShader"));
1734     }
1735
1736     if (funcs->compileShader)
1737         funcs->compileShader(shader);
1738     else
1739         funcs->compileShader = qglfResolveCompileShader;
1740 }
1741
1742 static void QGLF_APIENTRY qglfResolveCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
1743 {
1744     typedef void (QGLF_APIENTRYP type_glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
1745
1746     const QGLContext *context = QGLContext::currentContext();
1747     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1748
1749     funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
1750         context->getProcAddress(QLatin1String("glCompressedTexImage2D"));
1751 #ifdef QT_OPENGL_ES
1752     if (!funcs->compressedTexImage2D) {
1753         funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
1754             context->getProcAddress(QLatin1String("glCompressedTexImage2DOES"));
1755     }
1756 #endif
1757     if (!funcs->compressedTexImage2D) {
1758         funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
1759             context->getProcAddress(QLatin1String("glCompressedTexImage2DEXT"));
1760     }
1761     if (!funcs->compressedTexImage2D) {
1762         funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
1763             context->getProcAddress(QLatin1String("glCompressedTexImage2DARB"));
1764     }
1765
1766     if (funcs->compressedTexImage2D)
1767         funcs->compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
1768     else
1769         funcs->compressedTexImage2D = qglfResolveCompressedTexImage2D;
1770 }
1771
1772 static void QGLF_APIENTRY qglfResolveCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
1773 {
1774     typedef void (QGLF_APIENTRYP type_glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
1775
1776     const QGLContext *context = QGLContext::currentContext();
1777     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1778
1779     funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
1780         context->getProcAddress(QLatin1String("glCompressedTexSubImage2D"));
1781 #ifdef QT_OPENGL_ES
1782     if (!funcs->compressedTexSubImage2D) {
1783         funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
1784             context->getProcAddress(QLatin1String("glCompressedTexSubImage2DOES"));
1785     }
1786 #endif
1787     if (!funcs->compressedTexSubImage2D) {
1788         funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
1789             context->getProcAddress(QLatin1String("glCompressedTexSubImage2DEXT"));
1790     }
1791     if (!funcs->compressedTexSubImage2D) {
1792         funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
1793             context->getProcAddress(QLatin1String("glCompressedTexSubImage2DARB"));
1794     }
1795
1796     if (funcs->compressedTexSubImage2D)
1797         funcs->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
1798     else
1799         funcs->compressedTexSubImage2D = qglfResolveCompressedTexSubImage2D;
1800 }
1801
1802 static GLuint QGLF_APIENTRY qglfResolveCreateProgram()
1803 {
1804     typedef GLuint (QGLF_APIENTRYP type_glCreateProgram)();
1805
1806     const QGLContext *context = QGLContext::currentContext();
1807     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1808
1809     funcs->createProgram = (type_glCreateProgram)
1810         context->getProcAddress(QLatin1String("glCreateProgram"));
1811     if (!funcs->createProgram) {
1812         funcs->createProgram = (type_glCreateProgram)
1813             context->getProcAddress(QLatin1String("glCreateProgramObjectARB"));
1814     }
1815
1816     if (funcs->createProgram)
1817         return funcs->createProgram();
1818     funcs->createProgram = qglfResolveCreateProgram;
1819     return GLuint(0);
1820 }
1821
1822 static GLuint QGLF_APIENTRY qglfResolveCreateShader(GLenum type)
1823 {
1824     typedef GLuint (QGLF_APIENTRYP type_glCreateShader)(GLenum type);
1825
1826     const QGLContext *context = QGLContext::currentContext();
1827     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1828
1829     funcs->createShader = (type_glCreateShader)
1830         context->getProcAddress(QLatin1String("glCreateShader"));
1831     if (!funcs->createShader) {
1832         funcs->createShader = (type_glCreateShader)
1833             context->getProcAddress(QLatin1String("glCreateShaderObjectARB"));
1834     }
1835
1836     if (funcs->createShader)
1837         return funcs->createShader(type);
1838     funcs->createShader = qglfResolveCreateShader;
1839     return GLuint(0);
1840 }
1841
1842 static void QGLF_APIENTRY qglfResolveDeleteBuffers(GLsizei n, const GLuint* buffers)
1843 {
1844     typedef void (QGLF_APIENTRYP type_glDeleteBuffers)(GLsizei n, const GLuint* buffers);
1845
1846     const QGLContext *context = QGLContext::currentContext();
1847     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1848
1849     funcs->deleteBuffers = (type_glDeleteBuffers)
1850         context->getProcAddress(QLatin1String("glDeleteBuffers"));
1851 #ifdef QT_OPENGL_ES
1852     if (!funcs->deleteBuffers) {
1853         funcs->deleteBuffers = (type_glDeleteBuffers)
1854             context->getProcAddress(QLatin1String("glDeleteBuffersOES"));
1855     }
1856 #endif
1857     if (!funcs->deleteBuffers) {
1858         funcs->deleteBuffers = (type_glDeleteBuffers)
1859             context->getProcAddress(QLatin1String("glDeleteBuffersEXT"));
1860     }
1861     if (!funcs->deleteBuffers) {
1862         funcs->deleteBuffers = (type_glDeleteBuffers)
1863             context->getProcAddress(QLatin1String("glDeleteBuffersARB"));
1864     }
1865
1866     if (funcs->deleteBuffers)
1867         funcs->deleteBuffers(n, buffers);
1868     else
1869         funcs->deleteBuffers = qglfResolveDeleteBuffers;
1870 }
1871
1872 static void QGLF_APIENTRY qglfResolveDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
1873 {
1874     typedef void (QGLF_APIENTRYP type_glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers);
1875
1876     const QGLContext *context = QGLContext::currentContext();
1877     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1878
1879     funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
1880         context->getProcAddress(QLatin1String("glDeleteFramebuffers"));
1881 #ifdef QT_OPENGL_ES
1882     if (!funcs->deleteFramebuffers) {
1883         funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
1884             context->getProcAddress(QLatin1String("glDeleteFramebuffersOES"));
1885     }
1886 #endif
1887     if (!funcs->deleteFramebuffers) {
1888         funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
1889             context->getProcAddress(QLatin1String("glDeleteFramebuffersEXT"));
1890     }
1891     if (!funcs->deleteFramebuffers) {
1892         funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
1893             context->getProcAddress(QLatin1String("glDeleteFramebuffersARB"));
1894     }
1895
1896     if (funcs->deleteFramebuffers)
1897         funcs->deleteFramebuffers(n, framebuffers);
1898     else
1899         funcs->deleteFramebuffers = qglfResolveDeleteFramebuffers;
1900 }
1901
1902 static void QGLF_APIENTRY qglfResolveDeleteProgram(GLuint program)
1903 {
1904     typedef void (QGLF_APIENTRYP type_glDeleteProgram)(GLuint program);
1905
1906     const QGLContext *context = QGLContext::currentContext();
1907     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1908
1909     funcs->deleteProgram = (type_glDeleteProgram)
1910         context->getProcAddress(QLatin1String("glDeleteProgram"));
1911     if (!funcs->deleteProgram) {
1912         funcs->deleteProgram = (type_glDeleteProgram)
1913             context->getProcAddress(QLatin1String("glDeleteObjectARB"));
1914     }
1915
1916     if (funcs->deleteProgram)
1917         funcs->deleteProgram(program);
1918     else
1919         funcs->deleteProgram = qglfResolveDeleteProgram;
1920 }
1921
1922 static void QGLF_APIENTRY qglfResolveDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
1923 {
1924     typedef void (QGLF_APIENTRYP type_glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers);
1925
1926     const QGLContext *context = QGLContext::currentContext();
1927     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1928
1929     funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
1930         context->getProcAddress(QLatin1String("glDeleteRenderbuffers"));
1931 #ifdef QT_OPENGL_ES
1932     if (!funcs->deleteRenderbuffers) {
1933         funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
1934             context->getProcAddress(QLatin1String("glDeleteRenderbuffersOES"));
1935     }
1936 #endif
1937     if (!funcs->deleteRenderbuffers) {
1938         funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
1939             context->getProcAddress(QLatin1String("glDeleteRenderbuffersEXT"));
1940     }
1941     if (!funcs->deleteRenderbuffers) {
1942         funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
1943             context->getProcAddress(QLatin1String("glDeleteRenderbuffersARB"));
1944     }
1945
1946     if (funcs->deleteRenderbuffers)
1947         funcs->deleteRenderbuffers(n, renderbuffers);
1948     else
1949         funcs->deleteRenderbuffers = qglfResolveDeleteRenderbuffers;
1950 }
1951
1952 static void QGLF_APIENTRY qglfResolveDeleteShader(GLuint shader)
1953 {
1954     typedef void (QGLF_APIENTRYP type_glDeleteShader)(GLuint shader);
1955
1956     const QGLContext *context = QGLContext::currentContext();
1957     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1958
1959     funcs->deleteShader = (type_glDeleteShader)
1960         context->getProcAddress(QLatin1String("glDeleteShader"));
1961     if (!funcs->deleteShader) {
1962         funcs->deleteShader = (type_glDeleteShader)
1963             context->getProcAddress(QLatin1String("glDeleteObjectARB"));
1964     }
1965
1966     if (funcs->deleteShader)
1967         funcs->deleteShader(shader);
1968     else
1969         funcs->deleteShader = qglfResolveDeleteShader;
1970 }
1971
1972 static void QGLF_APIENTRY qglfResolveDetachShader(GLuint program, GLuint shader)
1973 {
1974     typedef void (QGLF_APIENTRYP type_glDetachShader)(GLuint program, GLuint shader);
1975
1976     const QGLContext *context = QGLContext::currentContext();
1977     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1978
1979     funcs->detachShader = (type_glDetachShader)
1980         context->getProcAddress(QLatin1String("glDetachShader"));
1981     if (!funcs->detachShader) {
1982         funcs->detachShader = (type_glDetachShader)
1983             context->getProcAddress(QLatin1String("glDetachObjectARB"));
1984     }
1985
1986     if (funcs->detachShader)
1987         funcs->detachShader(program, shader);
1988     else
1989         funcs->detachShader = qglfResolveDetachShader;
1990 }
1991
1992 static void QGLF_APIENTRY qglfResolveDisableVertexAttribArray(GLuint index)
1993 {
1994     typedef void (QGLF_APIENTRYP type_glDisableVertexAttribArray)(GLuint index);
1995
1996     const QGLContext *context = QGLContext::currentContext();
1997     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
1998
1999     funcs->disableVertexAttribArray = (type_glDisableVertexAttribArray)
2000         context->getProcAddress(QLatin1String("glDisableVertexAttribArray"));
2001     if (!funcs->disableVertexAttribArray) {
2002         funcs->disableVertexAttribArray = (type_glDisableVertexAttribArray)
2003             context->getProcAddress(QLatin1String("glDisableVertexAttribArrayARB"));
2004     }
2005
2006     if (funcs->disableVertexAttribArray)
2007         funcs->disableVertexAttribArray(index);
2008     else
2009         funcs->disableVertexAttribArray = qglfResolveDisableVertexAttribArray;
2010 }
2011
2012 static void QGLF_APIENTRY qglfResolveEnableVertexAttribArray(GLuint index)
2013 {
2014     typedef void (QGLF_APIENTRYP type_glEnableVertexAttribArray)(GLuint index);
2015
2016     const QGLContext *context = QGLContext::currentContext();
2017     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2018
2019     funcs->enableVertexAttribArray = (type_glEnableVertexAttribArray)
2020         context->getProcAddress(QLatin1String("glEnableVertexAttribArray"));
2021     if (!funcs->enableVertexAttribArray) {
2022         funcs->enableVertexAttribArray = (type_glEnableVertexAttribArray)
2023             context->getProcAddress(QLatin1String("glEnableVertexAttribArrayARB"));
2024     }
2025
2026     if (funcs->enableVertexAttribArray)
2027         funcs->enableVertexAttribArray(index);
2028     else
2029         funcs->enableVertexAttribArray = qglfResolveEnableVertexAttribArray;
2030 }
2031
2032 static void QGLF_APIENTRY qglfResolveFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
2033 {
2034     typedef void (QGLF_APIENTRYP type_glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
2035
2036     const QGLContext *context = QGLContext::currentContext();
2037     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2038
2039     funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
2040         context->getProcAddress(QLatin1String("glFramebufferRenderbuffer"));
2041 #ifdef QT_OPENGL_ES
2042     if (!funcs->framebufferRenderbuffer) {
2043         funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
2044             context->getProcAddress(QLatin1String("glFramebufferRenderbufferOES"));
2045     }
2046 #endif
2047     if (!funcs->framebufferRenderbuffer) {
2048         funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
2049             context->getProcAddress(QLatin1String("glFramebufferRenderbufferEXT"));
2050     }
2051     if (!funcs->framebufferRenderbuffer) {
2052         funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
2053             context->getProcAddress(QLatin1String("glFramebufferRenderbufferARB"));
2054     }
2055
2056     if (funcs->framebufferRenderbuffer)
2057         funcs->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
2058     else
2059         funcs->framebufferRenderbuffer = qglfResolveFramebufferRenderbuffer;
2060 }
2061
2062 static void QGLF_APIENTRY qglfResolveFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
2063 {
2064     typedef void (QGLF_APIENTRYP type_glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
2065
2066     const QGLContext *context = QGLContext::currentContext();
2067     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2068
2069     funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
2070         context->getProcAddress(QLatin1String("glFramebufferTexture2D"));
2071 #ifdef QT_OPENGL_ES
2072     if (!funcs->framebufferTexture2D) {
2073         funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
2074             context->getProcAddress(QLatin1String("glFramebufferTexture2DOES"));
2075     }
2076 #endif
2077     if (!funcs->framebufferTexture2D) {
2078         funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
2079             context->getProcAddress(QLatin1String("glFramebufferTexture2DEXT"));
2080     }
2081     if (!funcs->framebufferTexture2D) {
2082         funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
2083             context->getProcAddress(QLatin1String("glFramebufferTexture2DARB"));
2084     }
2085
2086     if (funcs->framebufferTexture2D)
2087         funcs->framebufferTexture2D(target, attachment, textarget, texture, level);
2088     else
2089         funcs->framebufferTexture2D = qglfResolveFramebufferTexture2D;
2090 }
2091
2092 static void QGLF_APIENTRY qglfResolveGenBuffers(GLsizei n, GLuint* buffers)
2093 {
2094     typedef void (QGLF_APIENTRYP type_glGenBuffers)(GLsizei n, GLuint* buffers);
2095
2096     const QGLContext *context = QGLContext::currentContext();
2097     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2098
2099     funcs->genBuffers = (type_glGenBuffers)
2100         context->getProcAddress(QLatin1String("glGenBuffers"));
2101 #ifdef QT_OPENGL_ES
2102     if (!funcs->genBuffers) {
2103         funcs->genBuffers = (type_glGenBuffers)
2104             context->getProcAddress(QLatin1String("glGenBuffersOES"));
2105     }
2106 #endif
2107     if (!funcs->genBuffers) {
2108         funcs->genBuffers = (type_glGenBuffers)
2109             context->getProcAddress(QLatin1String("glGenBuffersEXT"));
2110     }
2111     if (!funcs->genBuffers) {
2112         funcs->genBuffers = (type_glGenBuffers)
2113             context->getProcAddress(QLatin1String("glGenBuffersARB"));
2114     }
2115
2116     if (funcs->genBuffers)
2117         funcs->genBuffers(n, buffers);
2118     else
2119         funcs->genBuffers = qglfResolveGenBuffers;
2120 }
2121
2122 static void QGLF_APIENTRY qglfResolveGenerateMipmap(GLenum target)
2123 {
2124     typedef void (QGLF_APIENTRYP type_glGenerateMipmap)(GLenum target);
2125
2126     const QGLContext *context = QGLContext::currentContext();
2127     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2128
2129     funcs->generateMipmap = (type_glGenerateMipmap)
2130         context->getProcAddress(QLatin1String("glGenerateMipmap"));
2131 #ifdef QT_OPENGL_ES
2132     if (!funcs->generateMipmap) {
2133         funcs->generateMipmap = (type_glGenerateMipmap)
2134             context->getProcAddress(QLatin1String("glGenerateMipmapOES"));
2135     }
2136 #endif
2137     if (!funcs->generateMipmap) {
2138         funcs->generateMipmap = (type_glGenerateMipmap)
2139             context->getProcAddress(QLatin1String("glGenerateMipmapEXT"));
2140     }
2141     if (!funcs->generateMipmap) {
2142         funcs->generateMipmap = (type_glGenerateMipmap)
2143             context->getProcAddress(QLatin1String("glGenerateMipmapARB"));
2144     }
2145
2146     if (funcs->generateMipmap)
2147         funcs->generateMipmap(target);
2148     else
2149         funcs->generateMipmap = qglfResolveGenerateMipmap;
2150 }
2151
2152 static void QGLF_APIENTRY qglfResolveGenFramebuffers(GLsizei n, GLuint* framebuffers)
2153 {
2154     typedef void (QGLF_APIENTRYP type_glGenFramebuffers)(GLsizei n, GLuint* framebuffers);
2155
2156     const QGLContext *context = QGLContext::currentContext();
2157     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2158
2159     funcs->genFramebuffers = (type_glGenFramebuffers)
2160         context->getProcAddress(QLatin1String("glGenFramebuffers"));
2161 #ifdef QT_OPENGL_ES
2162     if (!funcs->genFramebuffers) {
2163         funcs->genFramebuffers = (type_glGenFramebuffers)
2164             context->getProcAddress(QLatin1String("glGenFramebuffersOES"));
2165     }
2166 #endif
2167     if (!funcs->genFramebuffers) {
2168         funcs->genFramebuffers = (type_glGenFramebuffers)
2169             context->getProcAddress(QLatin1String("glGenFramebuffersEXT"));
2170     }
2171     if (!funcs->genFramebuffers) {
2172         funcs->genFramebuffers = (type_glGenFramebuffers)
2173             context->getProcAddress(QLatin1String("glGenFramebuffersARB"));
2174     }
2175
2176     if (funcs->genFramebuffers)
2177         funcs->genFramebuffers(n, framebuffers);
2178     else
2179         funcs->genFramebuffers = qglfResolveGenFramebuffers;
2180 }
2181
2182 static void QGLF_APIENTRY qglfResolveGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
2183 {
2184     typedef void (QGLF_APIENTRYP type_glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers);
2185
2186     const QGLContext *context = QGLContext::currentContext();
2187     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2188
2189     funcs->genRenderbuffers = (type_glGenRenderbuffers)
2190         context->getProcAddress(QLatin1String("glGenRenderbuffers"));
2191 #ifdef QT_OPENGL_ES
2192     if (!funcs->genRenderbuffers) {
2193         funcs->genRenderbuffers = (type_glGenRenderbuffers)
2194             context->getProcAddress(QLatin1String("glGenRenderbuffersOES"));
2195     }
2196 #endif
2197     if (!funcs->genRenderbuffers) {
2198         funcs->genRenderbuffers = (type_glGenRenderbuffers)
2199             context->getProcAddress(QLatin1String("glGenRenderbuffersEXT"));
2200     }
2201     if (!funcs->genRenderbuffers) {
2202         funcs->genRenderbuffers = (type_glGenRenderbuffers)
2203             context->getProcAddress(QLatin1String("glGenRenderbuffersARB"));
2204     }
2205
2206     if (funcs->genRenderbuffers)
2207         funcs->genRenderbuffers(n, renderbuffers);
2208     else
2209         funcs->genRenderbuffers = qglfResolveGenRenderbuffers;
2210 }
2211
2212 static void QGLF_APIENTRY qglfResolveGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
2213 {
2214     typedef void (QGLF_APIENTRYP type_glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
2215
2216     const QGLContext *context = QGLContext::currentContext();
2217     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2218
2219     funcs->getActiveAttrib = (type_glGetActiveAttrib)
2220         context->getProcAddress(QLatin1String("glGetActiveAttrib"));
2221     if (!funcs->getActiveAttrib) {
2222         funcs->getActiveAttrib = (type_glGetActiveAttrib)
2223             context->getProcAddress(QLatin1String("glGetActiveAttribARB"));
2224     }
2225
2226     if (funcs->getActiveAttrib)
2227         funcs->getActiveAttrib(program, index, bufsize, length, size, type, name);
2228     else
2229         funcs->getActiveAttrib = qglfResolveGetActiveAttrib;
2230 }
2231
2232 static void QGLF_APIENTRY qglfResolveGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
2233 {
2234     typedef void (QGLF_APIENTRYP type_glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
2235
2236     const QGLContext *context = QGLContext::currentContext();
2237     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2238
2239     funcs->getActiveUniform = (type_glGetActiveUniform)
2240         context->getProcAddress(QLatin1String("glGetActiveUniform"));
2241     if (!funcs->getActiveUniform) {
2242         funcs->getActiveUniform = (type_glGetActiveUniform)
2243             context->getProcAddress(QLatin1String("glGetActiveUniformARB"));
2244     }
2245
2246     if (funcs->getActiveUniform)
2247         funcs->getActiveUniform(program, index, bufsize, length, size, type, name);
2248     else
2249         funcs->getActiveUniform = qglfResolveGetActiveUniform;
2250 }
2251
2252 static void QGLF_APIENTRY qglfResolveGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
2253 {
2254     typedef void (QGLF_APIENTRYP type_glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
2255
2256     const QGLContext *context = QGLContext::currentContext();
2257     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2258
2259     funcs->getAttachedShaders = (type_glGetAttachedShaders)
2260         context->getProcAddress(QLatin1String("glGetAttachedShaders"));
2261     if (!funcs->getAttachedShaders) {
2262         funcs->getAttachedShaders = (type_glGetAttachedShaders)
2263             context->getProcAddress(QLatin1String("glGetAttachedObjectsARB"));
2264     }
2265
2266     if (funcs->getAttachedShaders)
2267         funcs->getAttachedShaders(program, maxcount, count, shaders);
2268     else
2269         funcs->getAttachedShaders = qglfResolveGetAttachedShaders;
2270 }
2271
2272 static int QGLF_APIENTRY qglfResolveGetAttribLocation(GLuint program, const char* name)
2273 {
2274     typedef int (QGLF_APIENTRYP type_glGetAttribLocation)(GLuint program, const char* name);
2275
2276     const QGLContext *context = QGLContext::currentContext();
2277     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2278
2279     funcs->getAttribLocation = (type_glGetAttribLocation)
2280         context->getProcAddress(QLatin1String("glGetAttribLocation"));
2281     if (!funcs->getAttribLocation) {
2282         funcs->getAttribLocation = (type_glGetAttribLocation)
2283             context->getProcAddress(QLatin1String("glGetAttribLocationARB"));
2284     }
2285
2286     if (funcs->getAttribLocation)
2287         return funcs->getAttribLocation(program, name);
2288     funcs->getAttribLocation = qglfResolveGetAttribLocation;
2289     return int(0);
2290 }
2291
2292 static void QGLF_APIENTRY qglfResolveGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
2293 {
2294     typedef void (QGLF_APIENTRYP type_glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params);
2295
2296     const QGLContext *context = QGLContext::currentContext();
2297     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2298
2299     funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
2300         context->getProcAddress(QLatin1String("glGetBufferParameteriv"));
2301 #ifdef QT_OPENGL_ES
2302     if (!funcs->getBufferParameteriv) {
2303         funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
2304             context->getProcAddress(QLatin1String("glGetBufferParameterivOES"));
2305     }
2306 #endif
2307     if (!funcs->getBufferParameteriv) {
2308         funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
2309             context->getProcAddress(QLatin1String("glGetBufferParameterivEXT"));
2310     }
2311     if (!funcs->getBufferParameteriv) {
2312         funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
2313             context->getProcAddress(QLatin1String("glGetBufferParameterivARB"));
2314     }
2315
2316     if (funcs->getBufferParameteriv)
2317         funcs->getBufferParameteriv(target, pname, params);
2318     else
2319         funcs->getBufferParameteriv = qglfResolveGetBufferParameteriv;
2320 }
2321
2322 static void QGLF_APIENTRY qglfResolveGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
2323 {
2324     typedef void (QGLF_APIENTRYP type_glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params);
2325
2326     const QGLContext *context = QGLContext::currentContext();
2327     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2328
2329     funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
2330         context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameteriv"));
2331 #ifdef QT_OPENGL_ES
2332     if (!funcs->getFramebufferAttachmentParameteriv) {
2333         funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
2334             context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivOES"));
2335     }
2336 #endif
2337     if (!funcs->getFramebufferAttachmentParameteriv) {
2338         funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
2339             context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivEXT"));
2340     }
2341     if (!funcs->getFramebufferAttachmentParameteriv) {
2342         funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
2343             context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivARB"));
2344     }
2345
2346     if (funcs->getFramebufferAttachmentParameteriv)
2347         funcs->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
2348     else
2349         funcs->getFramebufferAttachmentParameteriv = qglfResolveGetFramebufferAttachmentParameteriv;
2350 }
2351
2352 static void QGLF_APIENTRY qglfResolveGetProgramiv(GLuint program, GLenum pname, GLint* params)
2353 {
2354     typedef void (QGLF_APIENTRYP type_glGetProgramiv)(GLuint program, GLenum pname, GLint* params);
2355
2356     const QGLContext *context = QGLContext::currentContext();
2357     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2358
2359     funcs->getProgramiv = (type_glGetProgramiv)
2360         context->getProcAddress(QLatin1String("glGetProgramiv"));
2361     if (!funcs->getProgramiv) {
2362         funcs->getProgramiv = (type_glGetProgramiv)
2363             context->getProcAddress(QLatin1String("glGetObjectParameterivARB"));
2364     }
2365
2366     if (funcs->getProgramiv)
2367         funcs->getProgramiv(program, pname, params);
2368     else
2369         funcs->getProgramiv = qglfResolveGetProgramiv;
2370 }
2371
2372 static void QGLF_APIENTRY qglfResolveGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
2373 {
2374     typedef void (QGLF_APIENTRYP type_glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
2375
2376     const QGLContext *context = QGLContext::currentContext();
2377     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2378
2379     funcs->getProgramInfoLog = (type_glGetProgramInfoLog)
2380         context->getProcAddress(QLatin1String("glGetProgramInfoLog"));
2381     if (!funcs->getProgramInfoLog) {
2382         funcs->getProgramInfoLog = (type_glGetProgramInfoLog)
2383             context->getProcAddress(QLatin1String("glGetInfoLogARB"));
2384     }
2385
2386     if (funcs->getProgramInfoLog)
2387         funcs->getProgramInfoLog(program, bufsize, length, infolog);
2388     else
2389         funcs->getProgramInfoLog = qglfResolveGetProgramInfoLog;
2390 }
2391
2392 static void QGLF_APIENTRY qglfResolveGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
2393 {
2394     typedef void (QGLF_APIENTRYP type_glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params);
2395
2396     const QGLContext *context = QGLContext::currentContext();
2397     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2398
2399     funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
2400         context->getProcAddress(QLatin1String("glGetRenderbufferParameteriv"));
2401 #ifdef QT_OPENGL_ES
2402     if (!funcs->getRenderbufferParameteriv) {
2403         funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
2404             context->getProcAddress(QLatin1String("glGetRenderbufferParameterivOES"));
2405     }
2406 #endif
2407     if (!funcs->getRenderbufferParameteriv) {
2408         funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
2409             context->getProcAddress(QLatin1String("glGetRenderbufferParameterivEXT"));
2410     }
2411     if (!funcs->getRenderbufferParameteriv) {
2412         funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
2413             context->getProcAddress(QLatin1String("glGetRenderbufferParameterivARB"));
2414     }
2415
2416     if (funcs->getRenderbufferParameteriv)
2417         funcs->getRenderbufferParameteriv(target, pname, params);
2418     else
2419         funcs->getRenderbufferParameteriv = qglfResolveGetRenderbufferParameteriv;
2420 }
2421
2422 static void QGLF_APIENTRY qglfResolveGetShaderiv(GLuint shader, GLenum pname, GLint* params)
2423 {
2424     typedef void (QGLF_APIENTRYP type_glGetShaderiv)(GLuint shader, GLenum pname, GLint* params);
2425
2426     const QGLContext *context = QGLContext::currentContext();
2427     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2428
2429     funcs->getShaderiv = (type_glGetShaderiv)
2430         context->getProcAddress(QLatin1String("glGetShaderiv"));
2431     if (!funcs->getShaderiv) {
2432         funcs->getShaderiv = (type_glGetShaderiv)
2433             context->getProcAddress(QLatin1String("glGetObjectParameterivARB"));
2434     }
2435
2436     if (funcs->getShaderiv)
2437         funcs->getShaderiv(shader, pname, params);
2438     else
2439         funcs->getShaderiv = qglfResolveGetShaderiv;
2440 }
2441
2442 static void QGLF_APIENTRY qglfResolveGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
2443 {
2444     typedef void (QGLF_APIENTRYP type_glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
2445
2446     const QGLContext *context = QGLContext::currentContext();
2447     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2448
2449     funcs->getShaderInfoLog = (type_glGetShaderInfoLog)
2450         context->getProcAddress(QLatin1String("glGetShaderInfoLog"));
2451     if (!funcs->getShaderInfoLog) {
2452         funcs->getShaderInfoLog = (type_glGetShaderInfoLog)
2453             context->getProcAddress(QLatin1String("glGetInfoLogARB"));
2454     }
2455
2456     if (funcs->getShaderInfoLog)
2457         funcs->getShaderInfoLog(shader, bufsize, length, infolog);
2458     else
2459         funcs->getShaderInfoLog = qglfResolveGetShaderInfoLog;
2460 }
2461
2462 static void QGLF_APIENTRY qglfSpecialGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
2463 {
2464     Q_UNUSED(shadertype);
2465     Q_UNUSED(precisiontype);
2466     range[0] = range[1] = precision[0] = 0;
2467 }
2468
2469 static void QGLF_APIENTRY qglfResolveGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
2470 {
2471     typedef void (QGLF_APIENTRYP type_glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
2472
2473     const QGLContext *context = QGLContext::currentContext();
2474     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2475
2476     funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
2477         context->getProcAddress(QLatin1String("glGetShaderPrecisionFormat"));
2478 #ifdef QT_OPENGL_ES
2479     if (!funcs->getShaderPrecisionFormat) {
2480         funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
2481             context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatOES"));
2482     }
2483 #endif
2484     if (!funcs->getShaderPrecisionFormat) {
2485         funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
2486             context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatEXT"));
2487     }
2488     if (!funcs->getShaderPrecisionFormat) {
2489         funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
2490             context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatARB"));
2491     }
2492
2493     if (!funcs->getShaderPrecisionFormat)
2494         funcs->getShaderPrecisionFormat = qglfSpecialGetShaderPrecisionFormat;
2495
2496     funcs->getShaderPrecisionFormat(shadertype, precisiontype, range, precision);
2497 }
2498
2499 static void QGLF_APIENTRY qglfResolveGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
2500 {
2501     typedef void (QGLF_APIENTRYP type_glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
2502
2503     const QGLContext *context = QGLContext::currentContext();
2504     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2505
2506     funcs->getShaderSource = (type_glGetShaderSource)
2507         context->getProcAddress(QLatin1String("glGetShaderSource"));
2508     if (!funcs->getShaderSource) {
2509         funcs->getShaderSource = (type_glGetShaderSource)
2510             context->getProcAddress(QLatin1String("glGetShaderSourceARB"));
2511     }
2512
2513     if (funcs->getShaderSource)
2514         funcs->getShaderSource(shader, bufsize, length, source);
2515     else
2516         funcs->getShaderSource = qglfResolveGetShaderSource;
2517 }
2518
2519 static void QGLF_APIENTRY qglfResolveGetUniformfv(GLuint program, GLint location, GLfloat* params)
2520 {
2521     typedef void (QGLF_APIENTRYP type_glGetUniformfv)(GLuint program, GLint location, GLfloat* params);
2522
2523     const QGLContext *context = QGLContext::currentContext();
2524     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2525
2526     funcs->getUniformfv = (type_glGetUniformfv)
2527         context->getProcAddress(QLatin1String("glGetUniformfv"));
2528     if (!funcs->getUniformfv) {
2529         funcs->getUniformfv = (type_glGetUniformfv)
2530             context->getProcAddress(QLatin1String("glGetUniformfvARB"));
2531     }
2532
2533     if (funcs->getUniformfv)
2534         funcs->getUniformfv(program, location, params);
2535     else
2536         funcs->getUniformfv = qglfResolveGetUniformfv;
2537 }
2538
2539 static void QGLF_APIENTRY qglfResolveGetUniformiv(GLuint program, GLint location, GLint* params)
2540 {
2541     typedef void (QGLF_APIENTRYP type_glGetUniformiv)(GLuint program, GLint location, GLint* params);
2542
2543     const QGLContext *context = QGLContext::currentContext();
2544     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2545
2546     funcs->getUniformiv = (type_glGetUniformiv)
2547         context->getProcAddress(QLatin1String("glGetUniformiv"));
2548     if (!funcs->getUniformiv) {
2549         funcs->getUniformiv = (type_glGetUniformiv)
2550             context->getProcAddress(QLatin1String("glGetUniformivARB"));
2551     }
2552
2553     if (funcs->getUniformiv)
2554         funcs->getUniformiv(program, location, params);
2555     else
2556         funcs->getUniformiv = qglfResolveGetUniformiv;
2557 }
2558
2559 static int QGLF_APIENTRY qglfResolveGetUniformLocation(GLuint program, const char* name)
2560 {
2561     typedef int (QGLF_APIENTRYP type_glGetUniformLocation)(GLuint program, const char* name);
2562
2563     const QGLContext *context = QGLContext::currentContext();
2564     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2565
2566     funcs->getUniformLocation = (type_glGetUniformLocation)
2567         context->getProcAddress(QLatin1String("glGetUniformLocation"));
2568     if (!funcs->getUniformLocation) {
2569         funcs->getUniformLocation = (type_glGetUniformLocation)
2570             context->getProcAddress(QLatin1String("glGetUniformLocationARB"));
2571     }
2572
2573     if (funcs->getUniformLocation)
2574         return funcs->getUniformLocation(program, name);
2575     funcs->getUniformLocation = qglfResolveGetUniformLocation;
2576     return int(0);
2577 }
2578
2579 static void QGLF_APIENTRY qglfResolveGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
2580 {
2581     typedef void (QGLF_APIENTRYP type_glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params);
2582
2583     const QGLContext *context = QGLContext::currentContext();
2584     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2585
2586     funcs->getVertexAttribfv = (type_glGetVertexAttribfv)
2587         context->getProcAddress(QLatin1String("glGetVertexAttribfv"));
2588     if (!funcs->getVertexAttribfv) {
2589         funcs->getVertexAttribfv = (type_glGetVertexAttribfv)
2590             context->getProcAddress(QLatin1String("glGetVertexAttribfvARB"));
2591     }
2592
2593     if (funcs->getVertexAttribfv)
2594         funcs->getVertexAttribfv(index, pname, params);
2595     else
2596         funcs->getVertexAttribfv = qglfResolveGetVertexAttribfv;
2597 }
2598
2599 static void QGLF_APIENTRY qglfResolveGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
2600 {
2601     typedef void (QGLF_APIENTRYP type_glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params);
2602
2603     const QGLContext *context = QGLContext::currentContext();
2604     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2605
2606     funcs->getVertexAttribiv = (type_glGetVertexAttribiv)
2607         context->getProcAddress(QLatin1String("glGetVertexAttribiv"));
2608     if (!funcs->getVertexAttribiv) {
2609         funcs->getVertexAttribiv = (type_glGetVertexAttribiv)
2610             context->getProcAddress(QLatin1String("glGetVertexAttribivARB"));
2611     }
2612
2613     if (funcs->getVertexAttribiv)
2614         funcs->getVertexAttribiv(index, pname, params);
2615     else
2616         funcs->getVertexAttribiv = qglfResolveGetVertexAttribiv;
2617 }
2618
2619 static void QGLF_APIENTRY qglfResolveGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
2620 {
2621     typedef void (QGLF_APIENTRYP type_glGetVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer);
2622
2623     const QGLContext *context = QGLContext::currentContext();
2624     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2625
2626     funcs->getVertexAttribPointerv = (type_glGetVertexAttribPointerv)
2627         context->getProcAddress(QLatin1String("glGetVertexAttribPointerv"));
2628     if (!funcs->getVertexAttribPointerv) {
2629         funcs->getVertexAttribPointerv = (type_glGetVertexAttribPointerv)
2630             context->getProcAddress(QLatin1String("glGetVertexAttribPointervARB"));
2631     }
2632
2633     if (funcs->getVertexAttribPointerv)
2634         funcs->getVertexAttribPointerv(index, pname, pointer);
2635     else
2636         funcs->getVertexAttribPointerv = qglfResolveGetVertexAttribPointerv;
2637 }
2638
2639 static GLboolean QGLF_APIENTRY qglfResolveIsBuffer(GLuint buffer)
2640 {
2641     typedef GLboolean (QGLF_APIENTRYP type_glIsBuffer)(GLuint buffer);
2642
2643     const QGLContext *context = QGLContext::currentContext();
2644     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2645
2646     funcs->isBuffer = (type_glIsBuffer)
2647         context->getProcAddress(QLatin1String("glIsBuffer"));
2648 #ifdef QT_OPENGL_ES
2649     if (!funcs->isBuffer) {
2650         funcs->isBuffer = (type_glIsBuffer)
2651             context->getProcAddress(QLatin1String("glIsBufferOES"));
2652     }
2653 #endif
2654     if (!funcs->isBuffer) {
2655         funcs->isBuffer = (type_glIsBuffer)
2656             context->getProcAddress(QLatin1String("glIsBufferEXT"));
2657     }
2658     if (!funcs->isBuffer) {
2659         funcs->isBuffer = (type_glIsBuffer)
2660             context->getProcAddress(QLatin1String("glIsBufferARB"));
2661     }
2662
2663     if (funcs->isBuffer)
2664         return funcs->isBuffer(buffer);
2665     funcs->isBuffer = qglfResolveIsBuffer;
2666     return GLboolean(0);
2667 }
2668
2669 static GLboolean QGLF_APIENTRY qglfResolveIsFramebuffer(GLuint framebuffer)
2670 {
2671     typedef GLboolean (QGLF_APIENTRYP type_glIsFramebuffer)(GLuint framebuffer);
2672
2673     const QGLContext *context = QGLContext::currentContext();
2674     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2675
2676     funcs->isFramebuffer = (type_glIsFramebuffer)
2677         context->getProcAddress(QLatin1String("glIsFramebuffer"));
2678 #ifdef QT_OPENGL_ES
2679     if (!funcs->isFramebuffer) {
2680         funcs->isFramebuffer = (type_glIsFramebuffer)
2681             context->getProcAddress(QLatin1String("glIsFramebufferOES"));
2682     }
2683 #endif
2684     if (!funcs->isFramebuffer) {
2685         funcs->isFramebuffer = (type_glIsFramebuffer)
2686             context->getProcAddress(QLatin1String("glIsFramebufferEXT"));
2687     }
2688     if (!funcs->isFramebuffer) {
2689         funcs->isFramebuffer = (type_glIsFramebuffer)
2690             context->getProcAddress(QLatin1String("glIsFramebufferARB"));
2691     }
2692
2693     if (funcs->isFramebuffer)
2694         return funcs->isFramebuffer(framebuffer);
2695     funcs->isFramebuffer = qglfResolveIsFramebuffer;
2696     return GLboolean(0);
2697 }
2698
2699 static GLboolean QGLF_APIENTRY qglfSpecialIsProgram(GLuint program)
2700 {
2701     return program != 0;
2702 }
2703
2704 static GLboolean QGLF_APIENTRY qglfResolveIsProgram(GLuint program)
2705 {
2706     typedef GLboolean (QGLF_APIENTRYP type_glIsProgram)(GLuint program);
2707
2708     const QGLContext *context = QGLContext::currentContext();
2709     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2710
2711     funcs->isProgram = (type_glIsProgram)
2712         context->getProcAddress(QLatin1String("glIsProgram"));
2713     if (!funcs->isProgram) {
2714         funcs->isProgram = (type_glIsProgram)
2715             context->getProcAddress(QLatin1String("glIsProgramARB"));
2716     }
2717
2718     if (!funcs->isProgram)
2719         funcs->isProgram = qglfSpecialIsProgram;
2720
2721     return funcs->isProgram(program);
2722 }
2723
2724 static GLboolean QGLF_APIENTRY qglfResolveIsRenderbuffer(GLuint renderbuffer)
2725 {
2726     typedef GLboolean (QGLF_APIENTRYP type_glIsRenderbuffer)(GLuint renderbuffer);
2727
2728     const QGLContext *context = QGLContext::currentContext();
2729     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2730
2731     funcs->isRenderbuffer = (type_glIsRenderbuffer)
2732         context->getProcAddress(QLatin1String("glIsRenderbuffer"));
2733 #ifdef QT_OPENGL_ES
2734     if (!funcs->isRenderbuffer) {
2735         funcs->isRenderbuffer = (type_glIsRenderbuffer)
2736             context->getProcAddress(QLatin1String("glIsRenderbufferOES"));
2737     }
2738 #endif
2739     if (!funcs->isRenderbuffer) {
2740         funcs->isRenderbuffer = (type_glIsRenderbuffer)
2741             context->getProcAddress(QLatin1String("glIsRenderbufferEXT"));
2742     }
2743     if (!funcs->isRenderbuffer) {
2744         funcs->isRenderbuffer = (type_glIsRenderbuffer)
2745             context->getProcAddress(QLatin1String("glIsRenderbufferARB"));
2746     }
2747
2748     if (funcs->isRenderbuffer)
2749         return funcs->isRenderbuffer(renderbuffer);
2750     funcs->isRenderbuffer = qglfResolveIsRenderbuffer;
2751     return GLboolean(0);
2752 }
2753
2754 static GLboolean QGLF_APIENTRY qglfSpecialIsShader(GLuint shader)
2755 {
2756     return shader != 0;
2757 }
2758
2759 static GLboolean QGLF_APIENTRY qglfResolveIsShader(GLuint shader)
2760 {
2761     typedef GLboolean (QGLF_APIENTRYP type_glIsShader)(GLuint shader);
2762
2763     const QGLContext *context = QGLContext::currentContext();
2764     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2765
2766     funcs->isShader = (type_glIsShader)
2767         context->getProcAddress(QLatin1String("glIsShader"));
2768     if (!funcs->isShader) {
2769         funcs->isShader = (type_glIsShader)
2770             context->getProcAddress(QLatin1String("glIsShaderARB"));
2771     }
2772
2773     if (!funcs->isShader)
2774         funcs->isShader = qglfSpecialIsShader;
2775
2776     return funcs->isShader(shader);
2777 }
2778
2779 static void QGLF_APIENTRY qglfResolveLinkProgram(GLuint program)
2780 {
2781     typedef void (QGLF_APIENTRYP type_glLinkProgram)(GLuint program);
2782
2783     const QGLContext *context = QGLContext::currentContext();
2784     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2785
2786     funcs->linkProgram = (type_glLinkProgram)
2787         context->getProcAddress(QLatin1String("glLinkProgram"));
2788     if (!funcs->linkProgram) {
2789         funcs->linkProgram = (type_glLinkProgram)
2790             context->getProcAddress(QLatin1String("glLinkProgramARB"));
2791     }
2792
2793     if (funcs->linkProgram)
2794         funcs->linkProgram(program);
2795     else
2796         funcs->linkProgram = qglfResolveLinkProgram;
2797 }
2798
2799 static void QGLF_APIENTRY qglfSpecialReleaseShaderCompiler()
2800 {
2801 }
2802
2803 static void QGLF_APIENTRY qglfResolveReleaseShaderCompiler()
2804 {
2805     typedef void (QGLF_APIENTRYP type_glReleaseShaderCompiler)();
2806
2807     const QGLContext *context = QGLContext::currentContext();
2808     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2809
2810     funcs->releaseShaderCompiler = (type_glReleaseShaderCompiler)
2811         context->getProcAddress(QLatin1String("glReleaseShaderCompiler"));
2812     if (!funcs->releaseShaderCompiler) {
2813         funcs->releaseShaderCompiler = (type_glReleaseShaderCompiler)
2814             context->getProcAddress(QLatin1String("glReleaseShaderCompilerARB"));
2815     }
2816
2817     if (!funcs->releaseShaderCompiler)
2818         funcs->releaseShaderCompiler = qglfSpecialReleaseShaderCompiler;
2819
2820     funcs->releaseShaderCompiler();
2821 }
2822
2823 static void QGLF_APIENTRY qglfResolveRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
2824 {
2825     typedef void (QGLF_APIENTRYP type_glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
2826
2827     const QGLContext *context = QGLContext::currentContext();
2828     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2829
2830     funcs->renderbufferStorage = (type_glRenderbufferStorage)
2831         context->getProcAddress(QLatin1String("glRenderbufferStorage"));
2832 #ifdef QT_OPENGL_ES
2833     if (!funcs->renderbufferStorage) {
2834         funcs->renderbufferStorage = (type_glRenderbufferStorage)
2835             context->getProcAddress(QLatin1String("glRenderbufferStorageOES"));
2836     }
2837 #endif
2838     if (!funcs->renderbufferStorage) {
2839         funcs->renderbufferStorage = (type_glRenderbufferStorage)
2840             context->getProcAddress(QLatin1String("glRenderbufferStorageEXT"));
2841     }
2842     if (!funcs->renderbufferStorage) {
2843         funcs->renderbufferStorage = (type_glRenderbufferStorage)
2844             context->getProcAddress(QLatin1String("glRenderbufferStorageARB"));
2845     }
2846
2847     if (funcs->renderbufferStorage)
2848         funcs->renderbufferStorage(target, internalformat, width, height);
2849     else
2850         funcs->renderbufferStorage = qglfResolveRenderbufferStorage;
2851 }
2852
2853 static void QGLF_APIENTRY qglfResolveSampleCoverage(GLclampf value, GLboolean invert)
2854 {
2855     typedef void (QGLF_APIENTRYP type_glSampleCoverage)(GLclampf value, GLboolean invert);
2856
2857     const QGLContext *context = QGLContext::currentContext();
2858     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2859
2860     funcs->sampleCoverage = (type_glSampleCoverage)
2861         context->getProcAddress(QLatin1String("glSampleCoverage"));
2862 #ifdef QT_OPENGL_ES
2863     if (!funcs->sampleCoverage) {
2864         funcs->sampleCoverage = (type_glSampleCoverage)
2865             context->getProcAddress(QLatin1String("glSampleCoverageOES"));
2866     }
2867 #endif
2868     if (!funcs->sampleCoverage) {
2869         funcs->sampleCoverage = (type_glSampleCoverage)
2870             context->getProcAddress(QLatin1String("glSampleCoverageEXT"));
2871     }
2872     if (!funcs->sampleCoverage) {
2873         funcs->sampleCoverage = (type_glSampleCoverage)
2874             context->getProcAddress(QLatin1String("glSampleCoverageARB"));
2875     }
2876
2877     if (funcs->sampleCoverage)
2878         funcs->sampleCoverage(value, invert);
2879     else
2880         funcs->sampleCoverage = qglfResolveSampleCoverage;
2881 }
2882
2883 static void QGLF_APIENTRY qglfResolveShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
2884 {
2885     typedef void (QGLF_APIENTRYP type_glShaderBinary)(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
2886
2887     const QGLContext *context = QGLContext::currentContext();
2888     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2889
2890     funcs->shaderBinary = (type_glShaderBinary)
2891         context->getProcAddress(QLatin1String("glShaderBinary"));
2892     if (!funcs->shaderBinary) {
2893         funcs->shaderBinary = (type_glShaderBinary)
2894             context->getProcAddress(QLatin1String("glShaderBinaryARB"));
2895     }
2896
2897     if (funcs->shaderBinary)
2898         funcs->shaderBinary(n, shaders, binaryformat, binary, length);
2899     else
2900         funcs->shaderBinary = qglfResolveShaderBinary;
2901 }
2902
2903 static void QGLF_APIENTRY qglfResolveShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
2904 {
2905     typedef void (QGLF_APIENTRYP type_glShaderSource)(GLuint shader, GLsizei count, const char** string, const GLint* length);
2906
2907     const QGLContext *context = QGLContext::currentContext();
2908     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2909
2910     funcs->shaderSource = (type_glShaderSource)
2911         context->getProcAddress(QLatin1String("glShaderSource"));
2912     if (!funcs->shaderSource) {
2913         funcs->shaderSource = (type_glShaderSource)
2914             context->getProcAddress(QLatin1String("glShaderSourceARB"));
2915     }
2916
2917     if (funcs->shaderSource)
2918         funcs->shaderSource(shader, count, string, length);
2919     else
2920         funcs->shaderSource = qglfResolveShaderSource;
2921 }
2922
2923 static void QGLF_APIENTRY qglfResolveStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
2924 {
2925     typedef void (QGLF_APIENTRYP type_glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);
2926
2927     const QGLContext *context = QGLContext::currentContext();
2928     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2929
2930     funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
2931         context->getProcAddress(QLatin1String("glStencilFuncSeparate"));
2932 #ifdef QT_OPENGL_ES
2933     if (!funcs->stencilFuncSeparate) {
2934         funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
2935             context->getProcAddress(QLatin1String("glStencilFuncSeparateOES"));
2936     }
2937 #endif
2938     if (!funcs->stencilFuncSeparate) {
2939         funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
2940             context->getProcAddress(QLatin1String("glStencilFuncSeparateEXT"));
2941     }
2942     if (!funcs->stencilFuncSeparate) {
2943         funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
2944             context->getProcAddress(QLatin1String("glStencilFuncSeparateARB"));
2945     }
2946
2947     if (funcs->stencilFuncSeparate)
2948         funcs->stencilFuncSeparate(face, func, ref, mask);
2949     else
2950         funcs->stencilFuncSeparate = qglfResolveStencilFuncSeparate;
2951 }
2952
2953 static void QGLF_APIENTRY qglfResolveStencilMaskSeparate(GLenum face, GLuint mask)
2954 {
2955     typedef void (QGLF_APIENTRYP type_glStencilMaskSeparate)(GLenum face, GLuint mask);
2956
2957     const QGLContext *context = QGLContext::currentContext();
2958     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2959
2960     funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
2961         context->getProcAddress(QLatin1String("glStencilMaskSeparate"));
2962 #ifdef QT_OPENGL_ES
2963     if (!funcs->stencilMaskSeparate) {
2964         funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
2965             context->getProcAddress(QLatin1String("glStencilMaskSeparateOES"));
2966     }
2967 #endif
2968     if (!funcs->stencilMaskSeparate) {
2969         funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
2970             context->getProcAddress(QLatin1String("glStencilMaskSeparateEXT"));
2971     }
2972     if (!funcs->stencilMaskSeparate) {
2973         funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
2974             context->getProcAddress(QLatin1String("glStencilMaskSeparateARB"));
2975     }
2976
2977     if (funcs->stencilMaskSeparate)
2978         funcs->stencilMaskSeparate(face, mask);
2979     else
2980         funcs->stencilMaskSeparate = qglfResolveStencilMaskSeparate;
2981 }
2982
2983 static void QGLF_APIENTRY qglfResolveStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
2984 {
2985     typedef void (QGLF_APIENTRYP type_glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
2986
2987     const QGLContext *context = QGLContext::currentContext();
2988     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
2989
2990     funcs->stencilOpSeparate = (type_glStencilOpSeparate)
2991         context->getProcAddress(QLatin1String("glStencilOpSeparate"));
2992 #ifdef QT_OPENGL_ES
2993     if (!funcs->stencilOpSeparate) {
2994         funcs->stencilOpSeparate = (type_glStencilOpSeparate)
2995             context->getProcAddress(QLatin1String("glStencilOpSeparateOES"));
2996     }
2997 #endif
2998     if (!funcs->stencilOpSeparate) {
2999         funcs->stencilOpSeparate = (type_glStencilOpSeparate)
3000             context->getProcAddress(QLatin1String("glStencilOpSeparateEXT"));
3001     }
3002     if (!funcs->stencilOpSeparate) {
3003         funcs->stencilOpSeparate = (type_glStencilOpSeparate)
3004             context->getProcAddress(QLatin1String("glStencilOpSeparateARB"));
3005     }
3006
3007     if (funcs->stencilOpSeparate)
3008         funcs->stencilOpSeparate(face, fail, zfail, zpass);
3009     else
3010         funcs->stencilOpSeparate = qglfResolveStencilOpSeparate;
3011 }
3012
3013 static void QGLF_APIENTRY qglfResolveUniform1f(GLint location, GLfloat x)
3014 {
3015     typedef void (QGLF_APIENTRYP type_glUniform1f)(GLint location, GLfloat x);
3016
3017     const QGLContext *context = QGLContext::currentContext();
3018     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3019
3020     funcs->uniform1f = (type_glUniform1f)
3021         context->getProcAddress(QLatin1String("glUniform1f"));
3022     if (!funcs->uniform1f) {
3023         funcs->uniform1f = (type_glUniform1f)
3024             context->getProcAddress(QLatin1String("glUniform1fARB"));
3025     }
3026
3027     if (funcs->uniform1f)
3028         funcs->uniform1f(location, x);
3029     else
3030         funcs->uniform1f = qglfResolveUniform1f;
3031 }
3032
3033 static void QGLF_APIENTRY qglfResolveUniform1fv(GLint location, GLsizei count, const GLfloat* v)
3034 {
3035     typedef void (QGLF_APIENTRYP type_glUniform1fv)(GLint location, GLsizei count, const GLfloat* v);
3036
3037     const QGLContext *context = QGLContext::currentContext();
3038     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3039
3040     funcs->uniform1fv = (type_glUniform1fv)
3041         context->getProcAddress(QLatin1String("glUniform1fv"));
3042     if (!funcs->uniform1fv) {
3043         funcs->uniform1fv = (type_glUniform1fv)
3044             context->getProcAddress(QLatin1String("glUniform1fvARB"));
3045     }
3046
3047     if (funcs->uniform1fv)
3048         funcs->uniform1fv(location, count, v);
3049     else
3050         funcs->uniform1fv = qglfResolveUniform1fv;
3051 }
3052
3053 static void QGLF_APIENTRY qglfResolveUniform1i(GLint location, GLint x)
3054 {
3055     typedef void (QGLF_APIENTRYP type_glUniform1i)(GLint location, GLint x);
3056
3057     const QGLContext *context = QGLContext::currentContext();
3058     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3059
3060     funcs->uniform1i = (type_glUniform1i)
3061         context->getProcAddress(QLatin1String("glUniform1i"));
3062     if (!funcs->uniform1i) {
3063         funcs->uniform1i = (type_glUniform1i)
3064             context->getProcAddress(QLatin1String("glUniform1iARB"));
3065     }
3066
3067     if (funcs->uniform1i)
3068         funcs->uniform1i(location, x);
3069     else
3070         funcs->uniform1i = qglfResolveUniform1i;
3071 }
3072
3073 static void QGLF_APIENTRY qglfResolveUniform1iv(GLint location, GLsizei count, const GLint* v)
3074 {
3075     typedef void (QGLF_APIENTRYP type_glUniform1iv)(GLint location, GLsizei count, const GLint* v);
3076
3077     const QGLContext *context = QGLContext::currentContext();
3078     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3079
3080     funcs->uniform1iv = (type_glUniform1iv)
3081         context->getProcAddress(QLatin1String("glUniform1iv"));
3082     if (!funcs->uniform1iv) {
3083         funcs->uniform1iv = (type_glUniform1iv)
3084             context->getProcAddress(QLatin1String("glUniform1ivARB"));
3085     }
3086
3087     if (funcs->uniform1iv)
3088         funcs->uniform1iv(location, count, v);
3089     else
3090         funcs->uniform1iv = qglfResolveUniform1iv;
3091 }
3092
3093 static void QGLF_APIENTRY qglfResolveUniform2f(GLint location, GLfloat x, GLfloat y)
3094 {
3095     typedef void (QGLF_APIENTRYP type_glUniform2f)(GLint location, GLfloat x, GLfloat y);
3096
3097     const QGLContext *context = QGLContext::currentContext();
3098     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3099
3100     funcs->uniform2f = (type_glUniform2f)
3101         context->getProcAddress(QLatin1String("glUniform2f"));
3102     if (!funcs->uniform2f) {
3103         funcs->uniform2f = (type_glUniform2f)
3104             context->getProcAddress(QLatin1String("glUniform2fARB"));
3105     }
3106
3107     if (funcs->uniform2f)
3108         funcs->uniform2f(location, x, y);
3109     else
3110         funcs->uniform2f = qglfResolveUniform2f;
3111 }
3112
3113 static void QGLF_APIENTRY qglfResolveUniform2fv(GLint location, GLsizei count, const GLfloat* v)
3114 {
3115     typedef void (QGLF_APIENTRYP type_glUniform2fv)(GLint location, GLsizei count, const GLfloat* v);
3116
3117     const QGLContext *context = QGLContext::currentContext();
3118     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3119
3120     funcs->uniform2fv = (type_glUniform2fv)
3121         context->getProcAddress(QLatin1String("glUniform2fv"));
3122     if (!funcs->uniform2fv) {
3123         funcs->uniform2fv = (type_glUniform2fv)
3124             context->getProcAddress(QLatin1String("glUniform2fvARB"));
3125     }
3126
3127     if (funcs->uniform2fv)
3128         funcs->uniform2fv(location, count, v);
3129     else
3130         funcs->uniform2fv = qglfResolveUniform2fv;
3131 }
3132
3133 static void QGLF_APIENTRY qglfResolveUniform2i(GLint location, GLint x, GLint y)
3134 {
3135     typedef void (QGLF_APIENTRYP type_glUniform2i)(GLint location, GLint x, GLint y);
3136
3137     const QGLContext *context = QGLContext::currentContext();
3138     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3139
3140     funcs->uniform2i = (type_glUniform2i)
3141         context->getProcAddress(QLatin1String("glUniform2i"));
3142     if (!funcs->uniform2i) {
3143         funcs->uniform2i = (type_glUniform2i)
3144             context->getProcAddress(QLatin1String("glUniform2iARB"));
3145     }
3146
3147     if (funcs->uniform2i)
3148         funcs->uniform2i(location, x, y);
3149     else
3150         funcs->uniform2i = qglfResolveUniform2i;
3151 }
3152
3153 static void QGLF_APIENTRY qglfResolveUniform2iv(GLint location, GLsizei count, const GLint* v)
3154 {
3155     typedef void (QGLF_APIENTRYP type_glUniform2iv)(GLint location, GLsizei count, const GLint* v);
3156
3157     const QGLContext *context = QGLContext::currentContext();
3158     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3159
3160     funcs->uniform2iv = (type_glUniform2iv)
3161         context->getProcAddress(QLatin1String("glUniform2iv"));
3162     if (!funcs->uniform2iv) {
3163         funcs->uniform2iv = (type_glUniform2iv)
3164             context->getProcAddress(QLatin1String("glUniform2ivARB"));
3165     }
3166
3167     if (funcs->uniform2iv)
3168         funcs->uniform2iv(location, count, v);
3169     else
3170         funcs->uniform2iv = qglfResolveUniform2iv;
3171 }
3172
3173 static void QGLF_APIENTRY qglfResolveUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
3174 {
3175     typedef void (QGLF_APIENTRYP type_glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z);
3176
3177     const QGLContext *context = QGLContext::currentContext();
3178     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3179
3180     funcs->uniform3f = (type_glUniform3f)
3181         context->getProcAddress(QLatin1String("glUniform3f"));
3182     if (!funcs->uniform3f) {
3183         funcs->uniform3f = (type_glUniform3f)
3184             context->getProcAddress(QLatin1String("glUniform3fARB"));
3185     }
3186
3187     if (funcs->uniform3f)
3188         funcs->uniform3f(location, x, y, z);
3189     else
3190         funcs->uniform3f = qglfResolveUniform3f;
3191 }
3192
3193 static void QGLF_APIENTRY qglfResolveUniform3fv(GLint location, GLsizei count, const GLfloat* v)
3194 {
3195     typedef void (QGLF_APIENTRYP type_glUniform3fv)(GLint location, GLsizei count, const GLfloat* v);
3196
3197     const QGLContext *context = QGLContext::currentContext();
3198     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3199
3200     funcs->uniform3fv = (type_glUniform3fv)
3201         context->getProcAddress(QLatin1String("glUniform3fv"));
3202     if (!funcs->uniform3fv) {
3203         funcs->uniform3fv = (type_glUniform3fv)
3204             context->getProcAddress(QLatin1String("glUniform3fvARB"));
3205     }
3206
3207     if (funcs->uniform3fv)
3208         funcs->uniform3fv(location, count, v);
3209     else
3210         funcs->uniform3fv = qglfResolveUniform3fv;
3211 }
3212
3213 static void QGLF_APIENTRY qglfResolveUniform3i(GLint location, GLint x, GLint y, GLint z)
3214 {
3215     typedef void (QGLF_APIENTRYP type_glUniform3i)(GLint location, GLint x, GLint y, GLint z);
3216
3217     const QGLContext *context = QGLContext::currentContext();
3218     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3219
3220     funcs->uniform3i = (type_glUniform3i)
3221         context->getProcAddress(QLatin1String("glUniform3i"));
3222     if (!funcs->uniform3i) {
3223         funcs->uniform3i = (type_glUniform3i)
3224             context->getProcAddress(QLatin1String("glUniform3iARB"));
3225     }
3226
3227     if (funcs->uniform3i)
3228         funcs->uniform3i(location, x, y, z);
3229     else
3230         funcs->uniform3i = qglfResolveUniform3i;
3231 }
3232
3233 static void QGLF_APIENTRY qglfResolveUniform3iv(GLint location, GLsizei count, const GLint* v)
3234 {
3235     typedef void (QGLF_APIENTRYP type_glUniform3iv)(GLint location, GLsizei count, const GLint* v);
3236
3237     const QGLContext *context = QGLContext::currentContext();
3238     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3239
3240     funcs->uniform3iv = (type_glUniform3iv)
3241         context->getProcAddress(QLatin1String("glUniform3iv"));
3242     if (!funcs->uniform3iv) {
3243         funcs->uniform3iv = (type_glUniform3iv)
3244             context->getProcAddress(QLatin1String("glUniform3ivARB"));
3245     }
3246
3247     if (funcs->uniform3iv)
3248         funcs->uniform3iv(location, count, v);
3249     else
3250         funcs->uniform3iv = qglfResolveUniform3iv;
3251 }
3252
3253 static void QGLF_APIENTRY qglfResolveUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3254 {
3255     typedef void (QGLF_APIENTRYP type_glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
3256
3257     const QGLContext *context = QGLContext::currentContext();
3258     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3259
3260     funcs->uniform4f = (type_glUniform4f)
3261         context->getProcAddress(QLatin1String("glUniform4f"));
3262     if (!funcs->uniform4f) {
3263         funcs->uniform4f = (type_glUniform4f)
3264             context->getProcAddress(QLatin1String("glUniform4fARB"));
3265     }
3266
3267     if (funcs->uniform4f)
3268         funcs->uniform4f(location, x, y, z, w);
3269     else
3270         funcs->uniform4f = qglfResolveUniform4f;
3271 }
3272
3273 static void QGLF_APIENTRY qglfResolveUniform4fv(GLint location, GLsizei count, const GLfloat* v)
3274 {
3275     typedef void (QGLF_APIENTRYP type_glUniform4fv)(GLint location, GLsizei count, const GLfloat* v);
3276
3277     const QGLContext *context = QGLContext::currentContext();
3278     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3279
3280     funcs->uniform4fv = (type_glUniform4fv)
3281         context->getProcAddress(QLatin1String("glUniform4fv"));
3282     if (!funcs->uniform4fv) {
3283         funcs->uniform4fv = (type_glUniform4fv)
3284             context->getProcAddress(QLatin1String("glUniform4fvARB"));
3285     }
3286
3287     if (funcs->uniform4fv)
3288         funcs->uniform4fv(location, count, v);
3289     else
3290         funcs->uniform4fv = qglfResolveUniform4fv;
3291 }
3292
3293 static void QGLF_APIENTRY qglfResolveUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
3294 {
3295     typedef void (QGLF_APIENTRYP type_glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w);
3296
3297     const QGLContext *context = QGLContext::currentContext();
3298     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3299
3300     funcs->uniform4i = (type_glUniform4i)
3301         context->getProcAddress(QLatin1String("glUniform4i"));
3302     if (!funcs->uniform4i) {
3303         funcs->uniform4i = (type_glUniform4i)
3304             context->getProcAddress(QLatin1String("glUniform4iARB"));
3305     }
3306
3307     if (funcs->uniform4i)
3308         funcs->uniform4i(location, x, y, z, w);
3309     else
3310         funcs->uniform4i = qglfResolveUniform4i;
3311 }
3312
3313 static void QGLF_APIENTRY qglfResolveUniform4iv(GLint location, GLsizei count, const GLint* v)
3314 {
3315     typedef void (QGLF_APIENTRYP type_glUniform4iv)(GLint location, GLsizei count, const GLint* v);
3316
3317     const QGLContext *context = QGLContext::currentContext();
3318     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3319
3320     funcs->uniform4iv = (type_glUniform4iv)
3321         context->getProcAddress(QLatin1String("glUniform4iv"));
3322     if (!funcs->uniform4iv) {
3323         funcs->uniform4iv = (type_glUniform4iv)
3324             context->getProcAddress(QLatin1String("glUniform4ivARB"));
3325     }
3326
3327     if (funcs->uniform4iv)
3328         funcs->uniform4iv(location, count, v);
3329     else
3330         funcs->uniform4iv = qglfResolveUniform4iv;
3331 }
3332
3333 static void QGLF_APIENTRY qglfResolveUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3334 {
3335     typedef void (QGLF_APIENTRYP type_glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
3336
3337     const QGLContext *context = QGLContext::currentContext();
3338     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3339
3340     funcs->uniformMatrix2fv = (type_glUniformMatrix2fv)
3341         context->getProcAddress(QLatin1String("glUniformMatrix2fv"));
3342     if (!funcs->uniformMatrix2fv) {
3343         funcs->uniformMatrix2fv = (type_glUniformMatrix2fv)
3344             context->getProcAddress(QLatin1String("glUniformMatrix2fvARB"));
3345     }
3346
3347     if (funcs->uniformMatrix2fv)
3348         funcs->uniformMatrix2fv(location, count, transpose, value);
3349     else
3350         funcs->uniformMatrix2fv = qglfResolveUniformMatrix2fv;
3351 }
3352
3353 static void QGLF_APIENTRY qglfResolveUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3354 {
3355     typedef void (QGLF_APIENTRYP type_glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
3356
3357     const QGLContext *context = QGLContext::currentContext();
3358     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3359
3360     funcs->uniformMatrix3fv = (type_glUniformMatrix3fv)
3361         context->getProcAddress(QLatin1String("glUniformMatrix3fv"));
3362     if (!funcs->uniformMatrix3fv) {
3363         funcs->uniformMatrix3fv = (type_glUniformMatrix3fv)
3364             context->getProcAddress(QLatin1String("glUniformMatrix3fvARB"));
3365     }
3366
3367     if (funcs->uniformMatrix3fv)
3368         funcs->uniformMatrix3fv(location, count, transpose, value);
3369     else
3370         funcs->uniformMatrix3fv = qglfResolveUniformMatrix3fv;
3371 }
3372
3373 static void QGLF_APIENTRY qglfResolveUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3374 {
3375     typedef void (QGLF_APIENTRYP type_glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
3376
3377     const QGLContext *context = QGLContext::currentContext();
3378     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3379
3380     funcs->uniformMatrix4fv = (type_glUniformMatrix4fv)
3381         context->getProcAddress(QLatin1String("glUniformMatrix4fv"));
3382     if (!funcs->uniformMatrix4fv) {
3383         funcs->uniformMatrix4fv = (type_glUniformMatrix4fv)
3384             context->getProcAddress(QLatin1String("glUniformMatrix4fvARB"));
3385     }
3386
3387     if (funcs->uniformMatrix4fv)
3388         funcs->uniformMatrix4fv(location, count, transpose, value);
3389     else
3390         funcs->uniformMatrix4fv = qglfResolveUniformMatrix4fv;
3391 }
3392
3393 static void QGLF_APIENTRY qglfResolveUseProgram(GLuint program)
3394 {
3395     typedef void (QGLF_APIENTRYP type_glUseProgram)(GLuint program);
3396
3397     const QGLContext *context = QGLContext::currentContext();
3398     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3399
3400     funcs->useProgram = (type_glUseProgram)
3401         context->getProcAddress(QLatin1String("glUseProgram"));
3402     if (!funcs->useProgram) {
3403         funcs->useProgram = (type_glUseProgram)
3404             context->getProcAddress(QLatin1String("glUseProgramObjectARB"));
3405     }
3406
3407     if (funcs->useProgram)
3408         funcs->useProgram(program);
3409     else
3410         funcs->useProgram = qglfResolveUseProgram;
3411 }
3412
3413 static void QGLF_APIENTRY qglfResolveValidateProgram(GLuint program)
3414 {
3415     typedef void (QGLF_APIENTRYP type_glValidateProgram)(GLuint program);
3416
3417     const QGLContext *context = QGLContext::currentContext();
3418     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3419
3420     funcs->validateProgram = (type_glValidateProgram)
3421         context->getProcAddress(QLatin1String("glValidateProgram"));
3422     if (!funcs->validateProgram) {
3423         funcs->validateProgram = (type_glValidateProgram)
3424             context->getProcAddress(QLatin1String("glValidateProgramARB"));
3425     }
3426
3427     if (funcs->validateProgram)
3428         funcs->validateProgram(program);
3429     else
3430         funcs->validateProgram = qglfResolveValidateProgram;
3431 }
3432
3433 static void QGLF_APIENTRY qglfResolveVertexAttrib1f(GLuint indx, GLfloat x)
3434 {
3435     typedef void (QGLF_APIENTRYP type_glVertexAttrib1f)(GLuint indx, GLfloat x);
3436
3437     const QGLContext *context = QGLContext::currentContext();
3438     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3439
3440     funcs->vertexAttrib1f = (type_glVertexAttrib1f)
3441         context->getProcAddress(QLatin1String("glVertexAttrib1f"));
3442     if (!funcs->vertexAttrib1f) {
3443         funcs->vertexAttrib1f = (type_glVertexAttrib1f)
3444             context->getProcAddress(QLatin1String("glVertexAttrib1fARB"));
3445     }
3446
3447     if (funcs->vertexAttrib1f)
3448         funcs->vertexAttrib1f(indx, x);
3449     else
3450         funcs->vertexAttrib1f = qglfResolveVertexAttrib1f;
3451 }
3452
3453 static void QGLF_APIENTRY qglfResolveVertexAttrib1fv(GLuint indx, const GLfloat* values)
3454 {
3455     typedef void (QGLF_APIENTRYP type_glVertexAttrib1fv)(GLuint indx, const GLfloat* values);
3456
3457     const QGLContext *context = QGLContext::currentContext();
3458     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3459
3460     funcs->vertexAttrib1fv = (type_glVertexAttrib1fv)
3461         context->getProcAddress(QLatin1String("glVertexAttrib1fv"));
3462     if (!funcs->vertexAttrib1fv) {
3463         funcs->vertexAttrib1fv = (type_glVertexAttrib1fv)
3464             context->getProcAddress(QLatin1String("glVertexAttrib1fvARB"));
3465     }
3466
3467     if (funcs->vertexAttrib1fv)
3468         funcs->vertexAttrib1fv(indx, values);
3469     else
3470         funcs->vertexAttrib1fv = qglfResolveVertexAttrib1fv;
3471 }
3472
3473 static void QGLF_APIENTRY qglfResolveVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
3474 {
3475     typedef void (QGLF_APIENTRYP type_glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y);
3476
3477     const QGLContext *context = QGLContext::currentContext();
3478     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3479
3480     funcs->vertexAttrib2f = (type_glVertexAttrib2f)
3481         context->getProcAddress(QLatin1String("glVertexAttrib2f"));
3482     if (!funcs->vertexAttrib2f) {
3483         funcs->vertexAttrib2f = (type_glVertexAttrib2f)
3484             context->getProcAddress(QLatin1String("glVertexAttrib2fARB"));
3485     }
3486
3487     if (funcs->vertexAttrib2f)
3488         funcs->vertexAttrib2f(indx, x, y);
3489     else
3490         funcs->vertexAttrib2f = qglfResolveVertexAttrib2f;
3491 }
3492
3493 static void QGLF_APIENTRY qglfResolveVertexAttrib2fv(GLuint indx, const GLfloat* values)
3494 {
3495     typedef void (QGLF_APIENTRYP type_glVertexAttrib2fv)(GLuint indx, const GLfloat* values);
3496
3497     const QGLContext *context = QGLContext::currentContext();
3498     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3499
3500     funcs->vertexAttrib2fv = (type_glVertexAttrib2fv)
3501         context->getProcAddress(QLatin1String("glVertexAttrib2fv"));
3502     if (!funcs->vertexAttrib2fv) {
3503         funcs->vertexAttrib2fv = (type_glVertexAttrib2fv)
3504             context->getProcAddress(QLatin1String("glVertexAttrib2fvARB"));
3505     }
3506
3507     if (funcs->vertexAttrib2fv)
3508         funcs->vertexAttrib2fv(indx, values);
3509     else
3510         funcs->vertexAttrib2fv = qglfResolveVertexAttrib2fv;
3511 }
3512
3513 static void QGLF_APIENTRY qglfResolveVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
3514 {
3515     typedef void (QGLF_APIENTRYP type_glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
3516
3517     const QGLContext *context = QGLContext::currentContext();
3518     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3519
3520     funcs->vertexAttrib3f = (type_glVertexAttrib3f)
3521         context->getProcAddress(QLatin1String("glVertexAttrib3f"));
3522     if (!funcs->vertexAttrib3f) {
3523         funcs->vertexAttrib3f = (type_glVertexAttrib3f)
3524             context->getProcAddress(QLatin1String("glVertexAttrib3fARB"));
3525     }
3526
3527     if (funcs->vertexAttrib3f)
3528         funcs->vertexAttrib3f(indx, x, y, z);
3529     else
3530         funcs->vertexAttrib3f = qglfResolveVertexAttrib3f;
3531 }
3532
3533 static void QGLF_APIENTRY qglfResolveVertexAttrib3fv(GLuint indx, const GLfloat* values)
3534 {
3535     typedef void (QGLF_APIENTRYP type_glVertexAttrib3fv)(GLuint indx, const GLfloat* values);
3536
3537     const QGLContext *context = QGLContext::currentContext();
3538     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3539
3540     funcs->vertexAttrib3fv = (type_glVertexAttrib3fv)
3541         context->getProcAddress(QLatin1String("glVertexAttrib3fv"));
3542     if (!funcs->vertexAttrib3fv) {
3543         funcs->vertexAttrib3fv = (type_glVertexAttrib3fv)
3544             context->getProcAddress(QLatin1String("glVertexAttrib3fvARB"));
3545     }
3546
3547     if (funcs->vertexAttrib3fv)
3548         funcs->vertexAttrib3fv(indx, values);
3549     else
3550         funcs->vertexAttrib3fv = qglfResolveVertexAttrib3fv;
3551 }
3552
3553 static void QGLF_APIENTRY qglfResolveVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3554 {
3555     typedef void (QGLF_APIENTRYP type_glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
3556
3557     const QGLContext *context = QGLContext::currentContext();
3558     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3559
3560     funcs->vertexAttrib4f = (type_glVertexAttrib4f)
3561         context->getProcAddress(QLatin1String("glVertexAttrib4f"));
3562     if (!funcs->vertexAttrib4f) {
3563         funcs->vertexAttrib4f = (type_glVertexAttrib4f)
3564             context->getProcAddress(QLatin1String("glVertexAttrib4fARB"));
3565     }
3566
3567     if (funcs->vertexAttrib4f)
3568         funcs->vertexAttrib4f(indx, x, y, z, w);
3569     else
3570         funcs->vertexAttrib4f = qglfResolveVertexAttrib4f;
3571 }
3572
3573 static void QGLF_APIENTRY qglfResolveVertexAttrib4fv(GLuint indx, const GLfloat* values)
3574 {
3575     typedef void (QGLF_APIENTRYP type_glVertexAttrib4fv)(GLuint indx, const GLfloat* values);
3576
3577     const QGLContext *context = QGLContext::currentContext();
3578     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3579
3580     funcs->vertexAttrib4fv = (type_glVertexAttrib4fv)
3581         context->getProcAddress(QLatin1String("glVertexAttrib4fv"));
3582     if (!funcs->vertexAttrib4fv) {
3583         funcs->vertexAttrib4fv = (type_glVertexAttrib4fv)
3584             context->getProcAddress(QLatin1String("glVertexAttrib4fvARB"));
3585     }
3586
3587     if (funcs->vertexAttrib4fv)
3588         funcs->vertexAttrib4fv(indx, values);
3589     else
3590         funcs->vertexAttrib4fv = qglfResolveVertexAttrib4fv;
3591 }
3592
3593 static void QGLF_APIENTRY qglfResolveVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
3594 {
3595     typedef void (QGLF_APIENTRYP type_glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
3596
3597     const QGLContext *context = QGLContext::currentContext();
3598     QGLFunctionsPrivate *funcs = qt_gl_functions(context);
3599
3600     funcs->vertexAttribPointer = (type_glVertexAttribPointer)
3601         context->getProcAddress(QLatin1String("glVertexAttribPointer"));
3602     if (!funcs->vertexAttribPointer) {
3603         funcs->vertexAttribPointer = (type_glVertexAttribPointer)
3604             context->getProcAddress(QLatin1String("glVertexAttribPointerARB"));
3605     }
3606
3607     if (funcs->vertexAttribPointer)
3608         funcs->vertexAttribPointer(indx, size, type, normalized, stride, ptr);
3609     else
3610         funcs->vertexAttribPointer = qglfResolveVertexAttribPointer;
3611 }
3612
3613 #endif // !QT_OPENGL_ES_2
3614
3615 QGLFunctionsPrivate::QGLFunctionsPrivate(const QGLContext *)
3616 {
3617 #ifndef QT_OPENGL_ES_2
3618     activeTexture = qglfResolveActiveTexture;
3619     attachShader = qglfResolveAttachShader;
3620     bindAttribLocation = qglfResolveBindAttribLocation;
3621     bindBuffer = qglfResolveBindBuffer;
3622     bindFramebuffer = qglfResolveBindFramebuffer;
3623     bindRenderbuffer = qglfResolveBindRenderbuffer;
3624     blendColor = qglfResolveBlendColor;
3625     blendEquation = qglfResolveBlendEquation;
3626     blendEquationSeparate = qglfResolveBlendEquationSeparate;
3627     blendFuncSeparate = qglfResolveBlendFuncSeparate;
3628     bufferData = qglfResolveBufferData;
3629     bufferSubData = qglfResolveBufferSubData;
3630     checkFramebufferStatus = qglfResolveCheckFramebufferStatus;
3631     compileShader = qglfResolveCompileShader;
3632     compressedTexImage2D = qglfResolveCompressedTexImage2D;
3633     compressedTexSubImage2D = qglfResolveCompressedTexSubImage2D;
3634     createProgram = qglfResolveCreateProgram;
3635     createShader = qglfResolveCreateShader;
3636     deleteBuffers = qglfResolveDeleteBuffers;
3637     deleteFramebuffers = qglfResolveDeleteFramebuffers;
3638     deleteProgram = qglfResolveDeleteProgram;
3639     deleteRenderbuffers = qglfResolveDeleteRenderbuffers;
3640     deleteShader = qglfResolveDeleteShader;
3641     detachShader = qglfResolveDetachShader;
3642     disableVertexAttribArray = qglfResolveDisableVertexAttribArray;
3643     enableVertexAttribArray = qglfResolveEnableVertexAttribArray;
3644     framebufferRenderbuffer = qglfResolveFramebufferRenderbuffer;
3645     framebufferTexture2D = qglfResolveFramebufferTexture2D;
3646     genBuffers = qglfResolveGenBuffers;
3647     generateMipmap = qglfResolveGenerateMipmap;
3648     genFramebuffers = qglfResolveGenFramebuffers;
3649     genRenderbuffers = qglfResolveGenRenderbuffers;
3650     getActiveAttrib = qglfResolveGetActiveAttrib;
3651     getActiveUniform = qglfResolveGetActiveUniform;
3652     getAttachedShaders = qglfResolveGetAttachedShaders;
3653     getAttribLocation = qglfResolveGetAttribLocation;
3654     getBufferParameteriv = qglfResolveGetBufferParameteriv;
3655     getFramebufferAttachmentParameteriv = qglfResolveGetFramebufferAttachmentParameteriv;
3656     getProgramiv = qglfResolveGetProgramiv;
3657     getProgramInfoLog = qglfResolveGetProgramInfoLog;
3658     getRenderbufferParameteriv = qglfResolveGetRenderbufferParameteriv;
3659     getShaderiv = qglfResolveGetShaderiv;
3660     getShaderInfoLog = qglfResolveGetShaderInfoLog;
3661     getShaderPrecisionFormat = qglfResolveGetShaderPrecisionFormat;
3662     getShaderSource = qglfResolveGetShaderSource;
3663     getUniformfv = qglfResolveGetUniformfv;
3664     getUniformiv = qglfResolveGetUniformiv;
3665     getUniformLocation = qglfResolveGetUniformLocation;
3666     getVertexAttribfv = qglfResolveGetVertexAttribfv;
3667     getVertexAttribiv = qglfResolveGetVertexAttribiv;
3668     getVertexAttribPointerv = qglfResolveGetVertexAttribPointerv;
3669     isBuffer = qglfResolveIsBuffer;
3670     isFramebuffer = qglfResolveIsFramebuffer;
3671     isProgram = qglfResolveIsProgram;
3672     isRenderbuffer = qglfResolveIsRenderbuffer;
3673     isShader = qglfResolveIsShader;
3674     linkProgram = qglfResolveLinkProgram;
3675     releaseShaderCompiler = qglfResolveReleaseShaderCompiler;
3676     renderbufferStorage = qglfResolveRenderbufferStorage;
3677     sampleCoverage = qglfResolveSampleCoverage;
3678     shaderBinary = qglfResolveShaderBinary;
3679     shaderSource = qglfResolveShaderSource;
3680     stencilFuncSeparate = qglfResolveStencilFuncSeparate;
3681     stencilMaskSeparate = qglfResolveStencilMaskSeparate;
3682     stencilOpSeparate = qglfResolveStencilOpSeparate;
3683     uniform1f = qglfResolveUniform1f;
3684     uniform1fv = qglfResolveUniform1fv;
3685     uniform1i = qglfResolveUniform1i;
3686     uniform1iv = qglfResolveUniform1iv;
3687     uniform2f = qglfResolveUniform2f;
3688     uniform2fv = qglfResolveUniform2fv;
3689     uniform2i = qglfResolveUniform2i;
3690     uniform2iv = qglfResolveUniform2iv;
3691     uniform3f = qglfResolveUniform3f;
3692     uniform3fv = qglfResolveUniform3fv;
3693     uniform3i = qglfResolveUniform3i;
3694     uniform3iv = qglfResolveUniform3iv;
3695     uniform4f = qglfResolveUniform4f;
3696     uniform4fv = qglfResolveUniform4fv;
3697     uniform4i = qglfResolveUniform4i;
3698     uniform4iv = qglfResolveUniform4iv;
3699     uniformMatrix2fv = qglfResolveUniformMatrix2fv;
3700     uniformMatrix3fv = qglfResolveUniformMatrix3fv;
3701     uniformMatrix4fv = qglfResolveUniformMatrix4fv;
3702     useProgram = qglfResolveUseProgram;
3703     validateProgram = qglfResolveValidateProgram;
3704     vertexAttrib1f = qglfResolveVertexAttrib1f;
3705     vertexAttrib1fv = qglfResolveVertexAttrib1fv;
3706     vertexAttrib2f = qglfResolveVertexAttrib2f;
3707     vertexAttrib2fv = qglfResolveVertexAttrib2fv;
3708     vertexAttrib3f = qglfResolveVertexAttrib3f;
3709     vertexAttrib3fv = qglfResolveVertexAttrib3fv;
3710     vertexAttrib4f = qglfResolveVertexAttrib4f;
3711     vertexAttrib4fv = qglfResolveVertexAttrib4fv;
3712     vertexAttribPointer = qglfResolveVertexAttribPointer;
3713 #endif // !QT_OPENGL_ES_2
3714 }
3715
3716 QT_END_NAMESPACE