From 807ef9fde52c423088ab24f5b81146bc17d0afad Mon Sep 17 00:00:00 2001
From: Rhys Weatherley <rhys.weatherley@nokia.com>
Date: Fri, 13 Aug 2010 09:11:08 +1000
Subject: QGLFunctions - cross-platform access to ES2.0 API

---
 dist/changes-4.8.0                           |    2 +
 src/opengl/opengl.pro                        |    2 +
 src/opengl/qglfunctions.cpp                  | 3705 ++++++++++++++++++++++++++
 src/opengl/qglfunctions.h                    | 2290 ++++++++++++++++
 tests/auto/opengl.pro                        |    1 +
 tests/auto/qglfunctions/qglfunctions.pro     |    7 +
 tests/auto/qglfunctions/tst_qglfunctions.cpp |  238 ++
 7 files changed, 6245 insertions(+)
 create mode 100644 src/opengl/qglfunctions.cpp
 create mode 100644 src/opengl/qglfunctions.h
 create mode 100644 tests/auto/qglfunctions/qglfunctions.pro
 create mode 100644 tests/auto/qglfunctions/tst_qglfunctions.cpp

diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0
index f22460f..0c28274 100644
--- a/dist/changes-4.8.0
+++ b/dist/changes-4.8.0
@@ -46,6 +46,8 @@ QtGui
  QtOpenGL
  --------
  - Removed dependency of OpenGL Utility Library (GLU)
+ - Added QGLFunctions, which provides cross-platform access to the
+   OpenGL/ES 2.0 API.
 
 
 ****************************************************************************
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index d6011cf..81b964a 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -20,6 +20,7 @@ contains(QT_CONFIG, egl):CONFIG += egl
 HEADERS += qgl.h \
 	   qgl_p.h \
 	   qglcolormap.h \
+           qglfunctions.h \
 	   qglpixelbuffer.h \
            qglpixelbuffer_p.h \
 	   qglframebufferobject.h  \
@@ -31,6 +32,7 @@ HEADERS += qgl.h \
 
 SOURCES	+= qgl.cpp \
 	   qglcolormap.cpp \
+           qglfunctions.cpp \
 	   qglpixelbuffer.cpp \
 	   qglframebufferobject.cpp \
            qglextensions.cpp \
diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp
new file mode 100644
index 0000000..8a544c1
--- /dev/null
+++ b/src/opengl/qglfunctions.cpp
@@ -0,0 +1,3705 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qglfunctions.h"
+#include "qgl_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+    \class QGLFunctions
+    \brief The QGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API.
+    \since 4.8
+    \ingroup painting-3D
+
+    OpenGL/ES 2.0 defines a subset of the OpenGL specification that is
+    common across many desktop and embedded OpenGL implementations.
+    However, it can be difficult to use the functions from that subset
+    because they need to be resolved manually on desktop systems.
+
+    QGLFunctions provides a guaranteed API that is available on all
+    OpenGL systems and takes care of function resolution on systems
+    that need it.  The recommended way to use QGLFunctions is by
+    direct inheritance:
+
+    \code
+    class MyGLWidget : public QGLWidget, protected QGLFunctions
+    {
+        Q_OBJECT
+    public:
+        MyGLWidget(QWidget *parent = 0) : QGLWidget(parent) {}
+
+    protected:
+        void initializeGL();
+        void paintGL();
+    };
+
+    void MyGLWidget::initializeGL()
+    {
+        initializeGLFunctions();
+    }
+    \endcode
+
+    The \c{paintGL()} function can then use any of the OpenGL/ES 2.0
+    functions without explicit resolution, such as glActiveTexture()
+    in the following example:
+
+    \code
+    void MyGLWidget::paintGL()
+    {
+        glActiveTexture(GL_TEXTURE1);
+        glBindTexture(GL_TEXTURE_2D, textureId);
+        ...
+    }
+    \endcode
+
+    QGLFunctions can also be used directly for ad-hoc invocation
+    of OpenGL/ES 2.0 functions on all platforms:
+
+    \code
+    QGLFunctions glFuncs(QGLContext::currentContext());
+    glFuncs.glActiveTexture(GL_TEXTURE1);
+    \endcode
+
+    QGLFunctions provides wrappers for all OpenGL/ES 2.0 functions,
+    except those like \c{glDrawArrays()}, \c{glViewport()}, and
+    \c{glBindTexture()} that don't have portability issues.
+
+    Including the header for QGLFunctions will also define all of
+    the OpenGL/ES 2.0 macro constants that are not already defined by
+    the system's OpenGL headers, such as \c{GL_TEXTURE1} above.
+
+    The hasOpenGLFeature() and openGLFeatures() functions can be used
+    to determine if the OpenGL implementation has a major OpenGL/ES 2.0
+    feature.  For example, the following checks if non power of two
+    textures are available:
+
+    \code
+    QGLFunctions funcs(QGLContext::currentContext());
+    bool npot = funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures);
+    \endcode
+*/
+
+/*!
+    \enum QGLFunctions::OpenGLFeature
+    This enum defines OpenGL/ES 2.0 features that may be optional
+    on other platforms.
+
+    \value Multitexture glActiveTexture() function is available.
+    \value Shaders Shader functions are available.
+    \value Buffers Vertex and index buffer functions are available.
+    \value Framebuffers Framebuffer object functions are available.
+    \value BlendColor glBlendColor() is available.
+    \value BlendEquation glBlendEquation() is available.
+    \value BlendEquationSeparate glBlendEquationSeparate() is available.
+    \value BlendFuncSeparate glBlendFuncSeparate() is available.
+    \value BlendSubtract Blend subtract mode is available.
+    \value CompressedTextures Compressed texture functions are available.
+    \value Multisample glSampleCoverage() function is available.
+    \value StencilSeparate Separate stencil functions are available.
+    \value NPOTTextures Non power of two textures are available.
+*/
+
+// Hidden private fields for additional extension data.
+struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate
+{
+    QGLFunctionsPrivateEx(const QGLContext *context = 0)
+        : QGLFunctionsPrivate(context)
+        , m_features(-1) {}
+
+    int m_features;
+};
+
+#if QT_VERSION >= 0x040800
+Q_GLOBAL_STATIC(QGLContextGroupResource<QGLFunctionsPrivateEx>, qt_gl_functions_resource)
+#else
+static void qt_gl_functions_free(void *data)
+{
+    delete reinterpret_cast<QGLFunctionsPrivateEx *>(data);
+}
+
+Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_gl_functions_resource, (qt_gl_functions_free))
+#endif
+static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0)
+{
+    if (!context)
+        context = QGLContext::currentContext();
+    Q_ASSERT(context);
+    QGLFunctionsPrivateEx *funcs =
+        reinterpret_cast<QGLFunctionsPrivateEx *>
+            (qt_gl_functions_resource()->value(context));
+#if QT_VERSION < 0x040800
+    if (!funcs) {
+        funcs = new QGLFunctionsPrivateEx();
+        qt_gl_functions_resource()->insert(context, funcs);
+    }
+#endif
+    return funcs;
+}
+
+/*!
+    Constructs a default function resolver.  The resolver cannot
+    be used until initializeGLFunctions() is called to specify
+    the context.
+
+    \sa initializeGLFunctions()
+*/
+QGLFunctions::QGLFunctions()
+    : d_ptr(0)
+{
+}
+
+/*!
+    Constructs a function resolver for \a context.  If \a context
+    is null, then the resolver will be created for the current QGLContext.
+
+    An object constructed in this way can only be used with \a context
+    and other contexts that share with it.  Use initializeGLFunctions()
+    to change the object's context association.
+
+    \sa initializeGLFunctions()
+*/
+QGLFunctions::QGLFunctions(const QGLContext *context)
+    : d_ptr(qt_gl_functions(context))
+{
+}
+
+/*!
+    \fn QGLFunctions::~QGLFunctions()
+
+    Destroys this function resolver.
+*/
+
+static int qt_gl_resolve_features()
+{
+#if defined(QT_OPENGL_ES_2)
+    return QGLFunctions::Multitexture |
+           QGLFunctions::Shaders |
+           QGLFunctions::Buffers |
+           QGLFunctions::Framebuffers |
+           QGLFunctions::BlendColor |
+           QGLFunctions::BlendEquation |
+           QGLFunctions::BlendEquationSeparate |
+           QGLFunctions::BlendFuncSeparate |
+           QGLFunctions::BlendSubtract |
+           QGLFunctions::CompressedTextures |
+           QGLFunctions::Multisample |
+           QGLFunctions::StencilSeparate |
+           QGLFunctions::NPOTTextures;
+#elif defined(QT_OPENGL_ES)
+    int features = QGLFunctions::Multitexture |
+                   QGLFunctions::Buffers |
+                   QGLFunctions::CompressedTextures |
+                   QGLFunctions::Multisample;
+    QGLExtensionMatcher extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
+    if (extensions.match("GL_OES_framebuffer_object"))
+        features |= QGLFunctions::Framebuffers;
+    if (extensions.match("GL_OES_blend_equation_separate"))
+        features |= QGLFunctions::BlendEquationSeparate;
+    if (extensions.match("GL_OES_blend_func_separate"))
+        features |= QGLFunctions::BlendFuncSeparate;
+    if (extensions.match("GL_OES_blend_subtract"))
+        features |= QGLFunctions::BlendSubtract;
+    if (extensions.match("GL_OES_texture_npot"))
+        features |= QGLFunctions::NPOTTextures;
+    return features;
+#else
+    int features = 0;
+    QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags();
+    QGLExtensionMatcher extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
+
+    // Recognize features by extension name.
+    if (extensions.match("GL_ARB_multitexture"))
+        features |= QGLFunctions::Multitexture;
+    if (extensions.match("GL_ARB_shader_objects"))
+        features |= QGLFunctions::Shaders;
+    if (extensions.match("GL_EXT_framebuffer_object") ||
+            extensions.match("GL_ARB_framebuffer_object"))
+        features |= QGLFunctions::Framebuffers;
+    if (extensions.match("GL_EXT_blend_color"))
+        features |= QGLFunctions::BlendColor;
+    if (extensions.match("GL_EXT_blend_equation_separate"))
+        features |= QGLFunctions::BlendEquationSeparate;
+    if (extensions.match("GL_EXT_blend_func_separate"))
+        features |= QGLFunctions::BlendFuncSeparate;
+    if (extensions.match("GL_EXT_blend_subtract"))
+        features |= QGLFunctions::BlendSubtract;
+    if (extensions.match("GL_ARB_texture_compression"))
+        features |= QGLFunctions::CompressedTextures;
+    if (extensions.match("GL_ARB_multisample"))
+        features |= QGLFunctions::Multisample;
+    if (extensions.match("GL_ARB_texture_non_power_of_two"))
+        features |= QGLFunctions::NPOTTextures;
+
+    // Recognize features by minimum OpenGL version.
+    if (versions & QGLFormat::OpenGL_Version_1_2) {
+        features |= QGLFunctions::BlendColor |
+                    QGLFunctions::BlendEquation;
+    }
+    if (versions & QGLFormat::OpenGL_Version_1_3) {
+        features |= QGLFunctions::Multitexture |
+                    QGLFunctions::CompressedTextures |
+                    QGLFunctions::Multisample;
+    }
+    if (versions & QGLFormat::OpenGL_Version_1_4)
+        features |= QGLFunctions::BlendFuncSeparate;
+    if (versions & QGLFormat::OpenGL_Version_1_5)
+        features |= QGLFunctions::Buffers;
+    if (versions & QGLFormat::OpenGL_Version_2_0) {
+        features |= QGLFunctions::Shaders |
+                    QGLFunctions::StencilSeparate |
+                    QGLFunctions::BlendEquationSeparate |
+                    QGLFunctions::NPOTTextures;
+    }
+    return features;
+#endif
+}
+
+/*!
+    Returns the set of features that are present on this system's
+    OpenGL implementation.
+
+    It is assumed that the QGLContext associated with this function
+    resolver is current.
+
+    \sa hasOpenGLFeature()
+*/
+QGLFunctions::OpenGLFeatures QGLFunctions::openGLFeatures() const
+{
+    QGLFunctionsPrivateEx *d = static_cast<QGLFunctionsPrivateEx *>(d_ptr);
+    if (!d)
+        return 0;
+    if (d->m_features == -1)
+        d->m_features = qt_gl_resolve_features();
+    return QGLFunctions::OpenGLFeatures(d->m_features);
+}
+
+/*!
+    Returns true if \a feature is present on this system's OpenGL
+    implementation; false otherwise.
+
+    It is assumed that the QGLContext associated with this function
+    resolver is current.
+
+    \sa openGLFeatures()
+*/
+bool QGLFunctions::hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const
+{
+    QGLFunctionsPrivateEx *d = static_cast<QGLFunctionsPrivateEx *>(d_ptr);
+    if (!d)
+        return false;
+    if (d->m_features == -1)
+        d->m_features = qt_gl_resolve_features();
+    return (d->m_features & int(feature)) != 0;
+}
+
+/*!
+    Initializes GL function resolution for \a context.  If \a context
+    is null, then the current QGLContext will be used.
+
+    After calling this function, the QGLFunctions object can only be
+    used with \a context and other contexts that share with it.
+    Call initializeGLFunctions() again to change the object's context
+    association.
+*/
+void QGLFunctions::initializeGLFunctions(const QGLContext *context)
+{
+    d_ptr = qt_gl_functions(context);
+}
+
+/*!
+    \fn void QGLFunctions::glActiveTexture(GLenum texture)
+
+    Convenience function that calls glActiveTexture(\a texture).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glActiveTexture.xml}{glActiveTexture()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glAttachShader(GLuint program, GLuint shader)
+
+    Convenience function that calls glAttachShader(\a program, \a shader).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glAttachShader.xml}{glAttachShader()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name)
+
+    Convenience function that calls glBindAttribLocation(\a program, \a index, \a name).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBindAttribLocation.xml}{glBindAttribLocation()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glBindBuffer(GLenum target, GLuint buffer)
+
+    Convenience function that calls glBindBuffer(\a target, \a buffer).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBindBuffer.xml}{glBindBuffer()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer)
+
+    Convenience function that calls glBindFramebuffer(\a target, \a framebuffer).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBindFramebuffer.xml}{glBindFramebuffer()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+
+    Convenience function that calls glBindRenderbuffer(\a target, \a renderbuffer).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBindRenderbuffer.xml}{glBindRenderbuffer()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+
+    Convenience function that calls glBlendColor(\a red, \a green, \a blue, \a alpha).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendColor.xml}{glBlendColor()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glBlendEquation(GLenum mode)
+
+    Convenience function that calls glBlendEquation(\a mode).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquation.xml}{glBlendEquation()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+
+    Convenience function that calls glBlendEquationSeparate(\a modeRGB, \a modeAlpha).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquationSeparate.xml}{glBlendEquationSeparate()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+
+    Convenience function that calls glBlendFuncSeparate(\a srcRGB, \a dstRGB, \a srcAlpha, \a dstAlpha).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendFuncSeparate.xml}{glBlendFuncSeparate()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage)
+
+    Convenience function that calls glBufferData(\a target, \a size, \a data, \a usage).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBufferData.xml}{glBufferData()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data)
+
+    Convenience function that calls glBufferSubData(\a target, \a offset, \a size, \a data).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glBufferSubData.xml}{glBufferSubData()}.
+*/
+
+/*!
+    \fn GLenum QGLFunctions::glCheckFramebufferStatus(GLenum target)
+
+    Convenience function that calls glCheckFramebufferStatus(\a target).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glCheckFramebufferStatus.xml}{glCheckFramebufferStatus()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glClearDepthf(GLclampf depth)
+
+    Convenience function that calls glClearDepth(\a depth) on
+    desktop OpenGL systems and glClearDepthf(\a depth) on
+    embedded OpenGL/ES systems.
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glClearDepthf.xml}{glClearDepthf()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glCompileShader(GLuint shader)
+
+    Convenience function that calls glCompileShader(\a shader).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glCompileShader.xml}{glCompileShader()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
+
+    Convenience function that calls glCompressedTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a imageSize, \a data).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexImage2D.xml}{glCompressedTexImage2D()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
+
+    Convenience function that calls glCompressedTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a imageSize, \a data).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexSubImage2D.xml}{glCompressedTexSubImage2D()}.
+*/
+
+/*!
+    \fn GLuint QGLFunctions::glCreateProgram()
+
+    Convenience function that calls glCreateProgram().
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glCreateProgram.xml}{glCreateProgram()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn GLuint QGLFunctions::glCreateShader(GLenum type)
+
+    Convenience function that calls glCreateShader(\a type).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glCreateShader.xml}{glCreateShader()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
+
+    Convenience function that calls glDeleteBuffers(\a n, \a buffers).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteBuffers.xml}{glDeleteBuffers()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+
+    Convenience function that calls glDeleteFramebuffers(\a n, \a framebuffers).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteFramebuffers.xml}{glDeleteFramebuffers()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glDeleteProgram(GLuint program)
+
+    Convenience function that calls glDeleteProgram(\a program).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteProgram.xml}{glDeleteProgram()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+
+    Convenience function that calls glDeleteRenderbuffers(\a n, \a renderbuffers).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteRenderbuffers.xml}{glDeleteRenderbuffers()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glDeleteShader(GLuint shader)
+
+    Convenience function that calls glDeleteShader(\a shader).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteShader.xml}{glDeleteShader()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
+
+    Convenience function that calls glDepthRange(\a zNear, \a zFar) on
+    desktop OpenGL systems and glDepthRangef(\a zNear, \a zFar) on
+    embedded OpenGL/ES systems.
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glDepthRangef.xml}{glDepthRangef()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glDetachShader(GLuint program, GLuint shader)
+
+    Convenience function that calls glDetachShader(\a program, \a shader).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glDetachShader.xml}{glDetachShader()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glDisableVertexAttribArray(GLuint index)
+
+    Convenience function that calls glDisableVertexAttribArray(\a index).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glDisableVertexAttribArray.xml}{glDisableVertexAttribArray()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glEnableVertexAttribArray(GLuint index)
+
+    Convenience function that calls glEnableVertexAttribArray(\a index).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glEnableVertexAttribArray.xml}{glEnableVertexAttribArray()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+
+    Convenience function that calls glFramebufferRenderbuffer(\a target, \a attachment, \a renderbuffertarget, \a renderbuffer).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferRenderbuffer.xml}{glFramebufferRenderbuffer()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+
+    Convenience function that calls glFramebufferTexture2D(\a target, \a attachment, \a textarget, \a texture, \a level).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferTexture2D.xml}{glFramebufferTexture2D()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
+
+    Convenience function that calls glGenBuffers(\a n, \a buffers).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGenBuffers.xml}{glGenBuffers()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glGenerateMipmap(GLenum target)
+
+    Convenience function that calls glGenerateMipmap(\a target).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGenerateMipmap.xml}{glGenerateMipmap()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
+
+    Convenience function that calls glGenFramebuffers(\a n, \a framebuffers).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGenFramebuffers.xml}{glGenFramebuffers()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+
+    Convenience function that calls glGenRenderbuffers(\a n, \a renderbuffers).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGenRenderbuffers.xml}{glGenRenderbuffers()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+
+    Convenience function that calls glGetActiveAttrib(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveAttrib.xml}{glGetActiveAttrib()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+
+    Convenience function that calls glGetActiveUniform(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveUniform.xml}{glGetActiveUniform()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+
+    Convenience function that calls glGetAttachedShaders(\a program, \a maxcount, \a count, \a shaders).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttachedShaders.xml}{glGetAttachedShaders()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn int QGLFunctions::glGetAttribLocation(GLuint program, const char* name)
+
+    Convenience function that calls glGetAttribLocation(\a program, \a name).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttribLocation.xml}{glGetAttribLocation()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+
+    Convenience function that calls glGetBufferParameteriv(\a target, \a pname, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetBufferParameteriv.xml}{glGetBufferParameteriv()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+
+    Convenience function that calls glGetFramebufferAttachmentParameteriv(\a target, \a attachment, \a pname, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetFramebufferAttachmentParameteriv.xml}{glGetFramebufferAttachmentParameteriv()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params)
+
+    Convenience function that calls glGetProgramiv(\a program, \a pname, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramiv.xml}{glGetProgramiv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+
+    Convenience function that calls glGetProgramInfoLog(\a program, \a bufsize, \a length, \a infolog).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramInfoLog.xml}{glGetProgramInfoLog()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+
+    Convenience function that calls glGetRenderbufferParameteriv(\a target, \a pname, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetRenderbufferParameteriv.xml}{glGetRenderbufferParameteriv()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
+
+    Convenience function that calls glGetShaderiv(\a shader, \a pname, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderiv.xml}{glGetShaderiv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+
+    Convenience function that calls glGetShaderInfoLog(\a shader, \a bufsize, \a length, \a infolog).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderInfoLog.xml}{glGetShaderInfoLog()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+
+    Convenience function that calls glGetShaderPrecisionFormat(\a shadertype, \a precisiontype, \a range, \a precision).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderPrecisionFormat.xml}{glGetShaderPrecisionFormat()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+
+    Convenience function that calls glGetShaderSource(\a shader, \a bufsize, \a length, \a source).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderSource.xml}{glGetShaderSource()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params)
+
+    Convenience function that calls glGetUniformfv(\a program, \a location, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformfv.xml}{glGetUniformfv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params)
+
+    Convenience function that calls glGetUniformiv(\a program, \a location, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformiv.xml}{glGetUniformiv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn int QGLFunctions::glGetUniformLocation(GLuint program, const char* name)
+
+    Convenience function that calls glGetUniformLocation(\a program, \a name).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformLocation.xml}{glGetUniformLocation()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+
+    Convenience function that calls glGetVertexAttribfv(\a index, \a pname, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribfv.xml}{glGetVertexAttribfv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+
+    Convenience function that calls glGetVertexAttribiv(\a index, \a pname, \a params).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribiv.xml}{glGetVertexAttribiv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
+
+    Convenience function that calls glGetVertexAttribPointerv(\a index, \a pname, \a pointer).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribPointerv.xml}{glGetVertexAttribPointerv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn GLboolean QGLFunctions::glIsBuffer(GLuint buffer)
+
+    Convenience function that calls glIsBuffer(\a buffer).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsBuffer.xml}{glIsBuffer()}.
+*/
+
+/*!
+    \fn GLboolean QGLFunctions::glIsFramebuffer(GLuint framebuffer)
+
+    Convenience function that calls glIsFramebuffer(\a framebuffer).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsFramebuffer.xml}{glIsFramebuffer()}.
+*/
+
+/*!
+    \fn GLboolean QGLFunctions::glIsProgram(GLuint program)
+
+    Convenience function that calls glIsProgram(\a program).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsProgram.xml}{glIsProgram()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn GLboolean QGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
+
+    Convenience function that calls glIsRenderbuffer(\a renderbuffer).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsRenderbuffer.xml}{glIsRenderbuffer()}.
+*/
+
+/*!
+    \fn GLboolean QGLFunctions::glIsShader(GLuint shader)
+
+    Convenience function that calls glIsShader(\a shader).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsShader.xml}{glIsShader()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glLinkProgram(GLuint program)
+
+    Convenience function that calls glLinkProgram(\a program).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glLinkProgram.xml}{glLinkProgram()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glReleaseShaderCompiler()
+
+    Convenience function that calls glReleaseShaderCompiler().
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glReleaseShaderCompiler.xml}{glReleaseShaderCompiler()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+
+    Convenience function that calls glRenderbufferStorage(\a target, \a internalformat, \a width, \a height).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glRenderbufferStorage.xml}{glRenderbufferStorage()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
+
+    Convenience function that calls glSampleCoverage(\a value, \a invert).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glSampleCoverage.xml}{glSampleCoverage()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
+
+    Convenience function that calls glShaderBinary(\a n, \a shaders, \a binaryformat, \a binary, \a length).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glShaderBinary.xml}{glShaderBinary()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
+
+    Convenience function that calls glShaderSource(\a shader, \a count, \a string, \a length).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glShaderSource.xml}{glShaderSource()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+
+    Convenience function that calls glStencilFuncSeparate(\a face, \a func, \a ref, \a mask).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilFuncSeparate.xml}{glStencilFuncSeparate()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
+
+    Convenience function that calls glStencilMaskSeparate(\a face, \a mask).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilMaskSeparate.xml}{glStencilMaskSeparate()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+
+    Convenience function that calls glStencilOpSeparate(\a face, \a fail, \a zfail, \a zpass).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilOpSeparate.xml}{glStencilOpSeparate()}.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform1f(GLint location, GLfloat x)
+
+    Convenience function that calls glUniform1f(\a location, \a x).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1f.xml}{glUniform1f()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+
+    Convenience function that calls glUniform1fv(\a location, \a count, \a v).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1fv.xml}{glUniform1fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform1i(GLint location, GLint x)
+
+    Convenience function that calls glUniform1i(\a location, \a x).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1i.xml}{glUniform1i()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v)
+
+    Convenience function that calls glUniform1iv(\a location, \a count, \a v).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1iv.xml}{glUniform1iv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
+
+    Convenience function that calls glUniform2f(\a location, \a x, \a y).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2f.xml}{glUniform2f()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+
+    Convenience function that calls glUniform2fv(\a location, \a count, \a v).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2fv.xml}{glUniform2fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
+
+    Convenience function that calls glUniform2i(\a location, \a x, \a y).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2i.xml}{glUniform2i()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v)
+
+    Convenience function that calls glUniform2iv(\a location, \a count, \a v).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2iv.xml}{glUniform2iv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+
+    Convenience function that calls glUniform3f(\a location, \a x, \a y, \a z).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3f.xml}{glUniform3f()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+
+    Convenience function that calls glUniform3fv(\a location, \a count, \a v).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3fv.xml}{glUniform3fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z)
+
+    Convenience function that calls glUniform3i(\a location, \a x, \a y, \a z).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3i.xml}{glUniform3i()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v)
+
+    Convenience function that calls glUniform3iv(\a location, \a count, \a v).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3iv.xml}{glUniform3iv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+
+    Convenience function that calls glUniform4f(\a location, \a x, \a y, \a z, \a w).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4f.xml}{glUniform4f()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+
+    Convenience function that calls glUniform4fv(\a location, \a count, \a v).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4fv.xml}{glUniform4fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+
+    Convenience function that calls glUniform4i(\a location, \a x, \a y, \a z, \a w).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4i.xml}{glUniform4i()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v)
+
+    Convenience function that calls glUniform4iv(\a location, \a count, \a v).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4iv.xml}{glUniform4iv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+
+    Convenience function that calls glUniformMatrix2fv(\a location, \a count, \a transpose, \a value).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix2fv.xml}{glUniformMatrix2fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+
+    Convenience function that calls glUniformMatrix3fv(\a location, \a count, \a transpose, \a value).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix3fv.xml}{glUniformMatrix3fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+
+    Convenience function that calls glUniformMatrix4fv(\a location, \a count, \a transpose, \a value).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix4fv.xml}{glUniformMatrix4fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glUseProgram(GLuint program)
+
+    Convenience function that calls glUseProgram(\a program).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glUseProgram.xml}{glUseProgram()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glValidateProgram(GLuint program)
+
+    Convenience function that calls glValidateProgram(\a program).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glValidateProgram.xml}{glValidateProgram()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
+
+    Convenience function that calls glVertexAttrib1f(\a indx, \a x).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1f.xml}{glVertexAttrib1f()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values)
+
+    Convenience function that calls glVertexAttrib1fv(\a indx, \a values).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1fv.xml}{glVertexAttrib1fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+
+    Convenience function that calls glVertexAttrib2f(\a indx, \a x, \a y).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2f.xml}{glVertexAttrib2f()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values)
+
+    Convenience function that calls glVertexAttrib2fv(\a indx, \a values).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2fv.xml}{glVertexAttrib2fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+
+    Convenience function that calls glVertexAttrib3f(\a indx, \a x, \a y, \a z).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3f.xml}{glVertexAttrib3f()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values)
+
+    Convenience function that calls glVertexAttrib3fv(\a indx, \a values).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3fv.xml}{glVertexAttrib3fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+
+    Convenience function that calls glVertexAttrib4f(\a indx, \a x, \a y, \a z, \a w).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4f.xml}{glVertexAttrib4f()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values)
+
+    Convenience function that calls glVertexAttrib4fv(\a indx, \a values).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4fv.xml}{glVertexAttrib4fv()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+/*!
+    \fn void QGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
+
+    Convenience function that calls glVertexAttribPointer(\a indx, \a size, \a type, \a normalized, \a stride, \a ptr).
+
+    For more information, see the OpenGL/ES 2.0 documentation for
+    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttribPointer.xml}{glVertexAttribPointer()}.
+
+    This convenience function will do nothing on OpenGL/ES 1.x systems.
+*/
+
+#ifndef QT_OPENGL_ES_2
+
+static void qglfResolveActiveTexture(GLenum texture)
+{
+    typedef void (QGLF_APIENTRYP type_glActiveTexture)(GLenum texture);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->activeTexture = (type_glActiveTexture)
+        context->getProcAddress(QLatin1String("glActiveTexture"));
+    if (!funcs->activeTexture) {
+        funcs->activeTexture = (type_glActiveTexture)
+            context->getProcAddress(QLatin1String("glActiveTextureARB"));
+    }
+
+    if (funcs->activeTexture)
+        funcs->activeTexture(texture);
+    else
+        funcs->activeTexture = qglfResolveActiveTexture;
+}
+
+static void qglfResolveAttachShader(GLuint program, GLuint shader)
+{
+    typedef void (QGLF_APIENTRYP type_glAttachShader)(GLuint program, GLuint shader);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->attachShader = (type_glAttachShader)
+        context->getProcAddress(QLatin1String("glAttachShader"));
+    if (!funcs->attachShader) {
+        funcs->attachShader = (type_glAttachShader)
+            context->getProcAddress(QLatin1String("glAttachObjectARB"));
+    }
+
+    if (funcs->attachShader)
+        funcs->attachShader(program, shader);
+    else
+        funcs->attachShader = qglfResolveAttachShader;
+}
+
+static void qglfResolveBindAttribLocation(GLuint program, GLuint index, const char* name)
+{
+    typedef void (QGLF_APIENTRYP type_glBindAttribLocation)(GLuint program, GLuint index, const char* name);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->bindAttribLocation = (type_glBindAttribLocation)
+        context->getProcAddress(QLatin1String("glBindAttribLocation"));
+    if (!funcs->bindAttribLocation) {
+        funcs->bindAttribLocation = (type_glBindAttribLocation)
+            context->getProcAddress(QLatin1String("glBindAttribLocationARB"));
+    }
+
+    if (funcs->bindAttribLocation)
+        funcs->bindAttribLocation(program, index, name);
+    else
+        funcs->bindAttribLocation = qglfResolveBindAttribLocation;
+}
+
+static void qglfResolveBindBuffer(GLenum target, GLuint buffer)
+{
+    typedef void (QGLF_APIENTRYP type_glBindBuffer)(GLenum target, GLuint buffer);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->bindBuffer = (type_glBindBuffer)
+        context->getProcAddress(QLatin1String("glBindBuffer"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->bindBuffer) {
+        funcs->bindBuffer = (type_glBindBuffer)
+            context->getProcAddress(QLatin1String("glBindBufferOES"));
+    }
+#endif
+    if (!funcs->bindBuffer) {
+        funcs->bindBuffer = (type_glBindBuffer)
+            context->getProcAddress(QLatin1String("glBindBufferEXT"));
+    }
+    if (!funcs->bindBuffer) {
+        funcs->bindBuffer = (type_glBindBuffer)
+            context->getProcAddress(QLatin1String("glBindBufferARB"));
+    }
+
+    if (funcs->bindBuffer)
+        funcs->bindBuffer(target, buffer);
+    else
+        funcs->bindBuffer = qglfResolveBindBuffer;
+}
+
+static void qglfResolveBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+    typedef void (QGLF_APIENTRYP type_glBindFramebuffer)(GLenum target, GLuint framebuffer);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->bindFramebuffer = (type_glBindFramebuffer)
+        context->getProcAddress(QLatin1String("glBindFramebuffer"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->bindFramebuffer) {
+        funcs->bindFramebuffer = (type_glBindFramebuffer)
+            context->getProcAddress(QLatin1String("glBindFramebufferOES"));
+    }
+#endif
+    if (!funcs->bindFramebuffer) {
+        funcs->bindFramebuffer = (type_glBindFramebuffer)
+            context->getProcAddress(QLatin1String("glBindFramebufferEXT"));
+    }
+    if (!funcs->bindFramebuffer) {
+        funcs->bindFramebuffer = (type_glBindFramebuffer)
+            context->getProcAddress(QLatin1String("glBindFramebufferARB"));
+    }
+
+    if (funcs->bindFramebuffer)
+        funcs->bindFramebuffer(target, framebuffer);
+    else
+        funcs->bindFramebuffer = qglfResolveBindFramebuffer;
+}
+
+static void qglfResolveBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+    typedef void (QGLF_APIENTRYP type_glBindRenderbuffer)(GLenum target, GLuint renderbuffer);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->bindRenderbuffer = (type_glBindRenderbuffer)
+        context->getProcAddress(QLatin1String("glBindRenderbuffer"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->bindRenderbuffer) {
+        funcs->bindRenderbuffer = (type_glBindRenderbuffer)
+            context->getProcAddress(QLatin1String("glBindRenderbufferOES"));
+    }
+#endif
+    if (!funcs->bindRenderbuffer) {
+        funcs->bindRenderbuffer = (type_glBindRenderbuffer)
+            context->getProcAddress(QLatin1String("glBindRenderbufferEXT"));
+    }
+    if (!funcs->bindRenderbuffer) {
+        funcs->bindRenderbuffer = (type_glBindRenderbuffer)
+            context->getProcAddress(QLatin1String("glBindRenderbufferARB"));
+    }
+
+    if (funcs->bindRenderbuffer)
+        funcs->bindRenderbuffer(target, renderbuffer);
+    else
+        funcs->bindRenderbuffer = qglfResolveBindRenderbuffer;
+}
+
+static void qglfResolveBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+    typedef void (QGLF_APIENTRYP type_glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->blendColor = (type_glBlendColor)
+        context->getProcAddress(QLatin1String("glBlendColor"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->blendColor) {
+        funcs->blendColor = (type_glBlendColor)
+            context->getProcAddress(QLatin1String("glBlendColorOES"));
+    }
+#endif
+    if (!funcs->blendColor) {
+        funcs->blendColor = (type_glBlendColor)
+            context->getProcAddress(QLatin1String("glBlendColorEXT"));
+    }
+    if (!funcs->blendColor) {
+        funcs->blendColor = (type_glBlendColor)
+            context->getProcAddress(QLatin1String("glBlendColorARB"));
+    }
+
+    if (funcs->blendColor)
+        funcs->blendColor(red, green, blue, alpha);
+    else
+        funcs->blendColor = qglfResolveBlendColor;
+}
+
+static void qglfResolveBlendEquation(GLenum mode)
+{
+    typedef void (QGLF_APIENTRYP type_glBlendEquation)(GLenum mode);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->blendEquation = (type_glBlendEquation)
+        context->getProcAddress(QLatin1String("glBlendEquation"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->blendEquation) {
+        funcs->blendEquation = (type_glBlendEquation)
+            context->getProcAddress(QLatin1String("glBlendEquationOES"));
+    }
+#endif
+    if (!funcs->blendEquation) {
+        funcs->blendEquation = (type_glBlendEquation)
+            context->getProcAddress(QLatin1String("glBlendEquationEXT"));
+    }
+    if (!funcs->blendEquation) {
+        funcs->blendEquation = (type_glBlendEquation)
+            context->getProcAddress(QLatin1String("glBlendEquationARB"));
+    }
+
+    if (funcs->blendEquation)
+        funcs->blendEquation(mode);
+    else
+        funcs->blendEquation = qglfResolveBlendEquation;
+}
+
+static void qglfResolveBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+    typedef void (QGLF_APIENTRYP type_glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
+        context->getProcAddress(QLatin1String("glBlendEquationSeparate"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->blendEquationSeparate) {
+        funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
+            context->getProcAddress(QLatin1String("glBlendEquationSeparateOES"));
+    }
+#endif
+    if (!funcs->blendEquationSeparate) {
+        funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
+            context->getProcAddress(QLatin1String("glBlendEquationSeparateEXT"));
+    }
+    if (!funcs->blendEquationSeparate) {
+        funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
+            context->getProcAddress(QLatin1String("glBlendEquationSeparateARB"));
+    }
+
+    if (funcs->blendEquationSeparate)
+        funcs->blendEquationSeparate(modeRGB, modeAlpha);
+    else
+        funcs->blendEquationSeparate = qglfResolveBlendEquationSeparate;
+}
+
+static void qglfResolveBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+    typedef void (QGLF_APIENTRYP type_glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
+        context->getProcAddress(QLatin1String("glBlendFuncSeparate"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->blendFuncSeparate) {
+        funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
+            context->getProcAddress(QLatin1String("glBlendFuncSeparateOES"));
+    }
+#endif
+    if (!funcs->blendFuncSeparate) {
+        funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
+            context->getProcAddress(QLatin1String("glBlendFuncSeparateEXT"));
+    }
+    if (!funcs->blendFuncSeparate) {
+        funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
+            context->getProcAddress(QLatin1String("glBlendFuncSeparateARB"));
+    }
+
+    if (funcs->blendFuncSeparate)
+        funcs->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+    else
+        funcs->blendFuncSeparate = qglfResolveBlendFuncSeparate;
+}
+
+static void qglfResolveBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage)
+{
+    typedef void (QGLF_APIENTRYP type_glBufferData)(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->bufferData = (type_glBufferData)
+        context->getProcAddress(QLatin1String("glBufferData"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->bufferData) {
+        funcs->bufferData = (type_glBufferData)
+            context->getProcAddress(QLatin1String("glBufferDataOES"));
+    }
+#endif
+    if (!funcs->bufferData) {
+        funcs->bufferData = (type_glBufferData)
+            context->getProcAddress(QLatin1String("glBufferDataEXT"));
+    }
+    if (!funcs->bufferData) {
+        funcs->bufferData = (type_glBufferData)
+            context->getProcAddress(QLatin1String("glBufferDataARB"));
+    }
+
+    if (funcs->bufferData)
+        funcs->bufferData(target, size, data, usage);
+    else
+        funcs->bufferData = qglfResolveBufferData;
+}
+
+static void qglfResolveBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data)
+{
+    typedef void (QGLF_APIENTRYP type_glBufferSubData)(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->bufferSubData = (type_glBufferSubData)
+        context->getProcAddress(QLatin1String("glBufferSubData"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->bufferSubData) {
+        funcs->bufferSubData = (type_glBufferSubData)
+            context->getProcAddress(QLatin1String("glBufferSubDataOES"));
+    }
+#endif
+    if (!funcs->bufferSubData) {
+        funcs->bufferSubData = (type_glBufferSubData)
+            context->getProcAddress(QLatin1String("glBufferSubDataEXT"));
+    }
+    if (!funcs->bufferSubData) {
+        funcs->bufferSubData = (type_glBufferSubData)
+            context->getProcAddress(QLatin1String("glBufferSubDataARB"));
+    }
+
+    if (funcs->bufferSubData)
+        funcs->bufferSubData(target, offset, size, data);
+    else
+        funcs->bufferSubData = qglfResolveBufferSubData;
+}
+
+static GLenum qglfResolveCheckFramebufferStatus(GLenum target)
+{
+    typedef GLenum (QGLF_APIENTRYP type_glCheckFramebufferStatus)(GLenum target);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
+        context->getProcAddress(QLatin1String("glCheckFramebufferStatus"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->checkFramebufferStatus) {
+        funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
+            context->getProcAddress(QLatin1String("glCheckFramebufferStatusOES"));
+    }
+#endif
+    if (!funcs->checkFramebufferStatus) {
+        funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
+            context->getProcAddress(QLatin1String("glCheckFramebufferStatusEXT"));
+    }
+    if (!funcs->checkFramebufferStatus) {
+        funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
+            context->getProcAddress(QLatin1String("glCheckFramebufferStatusARB"));
+    }
+
+    if (funcs->checkFramebufferStatus)
+        return funcs->checkFramebufferStatus(target);
+    funcs->checkFramebufferStatus = qglfResolveCheckFramebufferStatus;
+    return GLenum(0);
+}
+
+static void qglfResolveCompileShader(GLuint shader)
+{
+    typedef void (QGLF_APIENTRYP type_glCompileShader)(GLuint shader);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->compileShader = (type_glCompileShader)
+        context->getProcAddress(QLatin1String("glCompileShader"));
+    if (!funcs->compileShader) {
+        funcs->compileShader = (type_glCompileShader)
+            context->getProcAddress(QLatin1String("glCompileShader"));
+    }
+
+    if (funcs->compileShader)
+        funcs->compileShader(shader);
+    else
+        funcs->compileShader = qglfResolveCompileShader;
+}
+
+static void qglfResolveCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
+{
+    typedef void (QGLF_APIENTRYP type_glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
+        context->getProcAddress(QLatin1String("glCompressedTexImage2D"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->compressedTexImage2D) {
+        funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
+            context->getProcAddress(QLatin1String("glCompressedTexImage2DOES"));
+    }
+#endif
+    if (!funcs->compressedTexImage2D) {
+        funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
+            context->getProcAddress(QLatin1String("glCompressedTexImage2DEXT"));
+    }
+    if (!funcs->compressedTexImage2D) {
+        funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
+            context->getProcAddress(QLatin1String("glCompressedTexImage2DARB"));
+    }
+
+    if (funcs->compressedTexImage2D)
+        funcs->compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+    else
+        funcs->compressedTexImage2D = qglfResolveCompressedTexImage2D;
+}
+
+static void qglfResolveCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
+{
+    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);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
+        context->getProcAddress(QLatin1String("glCompressedTexSubImage2D"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->compressedTexSubImage2D) {
+        funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
+            context->getProcAddress(QLatin1String("glCompressedTexSubImage2DOES"));
+    }
+#endif
+    if (!funcs->compressedTexSubImage2D) {
+        funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
+            context->getProcAddress(QLatin1String("glCompressedTexSubImage2DEXT"));
+    }
+    if (!funcs->compressedTexSubImage2D) {
+        funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
+            context->getProcAddress(QLatin1String("glCompressedTexSubImage2DARB"));
+    }
+
+    if (funcs->compressedTexSubImage2D)
+        funcs->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+    else
+        funcs->compressedTexSubImage2D = qglfResolveCompressedTexSubImage2D;
+}
+
+static GLuint qglfResolveCreateProgram()
+{
+    typedef GLuint (QGLF_APIENTRYP type_glCreateProgram)();
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->createProgram = (type_glCreateProgram)
+        context->getProcAddress(QLatin1String("glCreateProgram"));
+    if (!funcs->createProgram) {
+        funcs->createProgram = (type_glCreateProgram)
+            context->getProcAddress(QLatin1String("glCreateProgramObjectARB"));
+    }
+
+    if (funcs->createProgram)
+        return funcs->createProgram();
+    funcs->createProgram = qglfResolveCreateProgram;
+    return GLuint(0);
+}
+
+static GLuint qglfResolveCreateShader(GLenum type)
+{
+    typedef GLuint (QGLF_APIENTRYP type_glCreateShader)(GLenum type);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->createShader = (type_glCreateShader)
+        context->getProcAddress(QLatin1String("glCreateShader"));
+    if (!funcs->createShader) {
+        funcs->createShader = (type_glCreateShader)
+            context->getProcAddress(QLatin1String("glCreateShaderObjectARB"));
+    }
+
+    if (funcs->createShader)
+        return funcs->createShader(type);
+    funcs->createShader = qglfResolveCreateShader;
+    return GLuint(0);
+}
+
+static void qglfResolveDeleteBuffers(GLsizei n, const GLuint* buffers)
+{
+    typedef void (QGLF_APIENTRYP type_glDeleteBuffers)(GLsizei n, const GLuint* buffers);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->deleteBuffers = (type_glDeleteBuffers)
+        context->getProcAddress(QLatin1String("glDeleteBuffers"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->deleteBuffers) {
+        funcs->deleteBuffers = (type_glDeleteBuffers)
+            context->getProcAddress(QLatin1String("glDeleteBuffersOES"));
+    }
+#endif
+    if (!funcs->deleteBuffers) {
+        funcs->deleteBuffers = (type_glDeleteBuffers)
+            context->getProcAddress(QLatin1String("glDeleteBuffersEXT"));
+    }
+    if (!funcs->deleteBuffers) {
+        funcs->deleteBuffers = (type_glDeleteBuffers)
+            context->getProcAddress(QLatin1String("glDeleteBuffersARB"));
+    }
+
+    if (funcs->deleteBuffers)
+        funcs->deleteBuffers(n, buffers);
+    else
+        funcs->deleteBuffers = qglfResolveDeleteBuffers;
+}
+
+static void qglfResolveDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+{
+    typedef void (QGLF_APIENTRYP type_glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
+        context->getProcAddress(QLatin1String("glDeleteFramebuffers"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->deleteFramebuffers) {
+        funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
+            context->getProcAddress(QLatin1String("glDeleteFramebuffersOES"));
+    }
+#endif
+    if (!funcs->deleteFramebuffers) {
+        funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
+            context->getProcAddress(QLatin1String("glDeleteFramebuffersEXT"));
+    }
+    if (!funcs->deleteFramebuffers) {
+        funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
+            context->getProcAddress(QLatin1String("glDeleteFramebuffersARB"));
+    }
+
+    if (funcs->deleteFramebuffers)
+        funcs->deleteFramebuffers(n, framebuffers);
+    else
+        funcs->deleteFramebuffers = qglfResolveDeleteFramebuffers;
+}
+
+static void qglfResolveDeleteProgram(GLuint program)
+{
+    typedef void (QGLF_APIENTRYP type_glDeleteProgram)(GLuint program);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->deleteProgram = (type_glDeleteProgram)
+        context->getProcAddress(QLatin1String("glDeleteProgram"));
+    if (!funcs->deleteProgram) {
+        funcs->deleteProgram = (type_glDeleteProgram)
+            context->getProcAddress(QLatin1String("glDeleteObjectARB"));
+    }
+
+    if (funcs->deleteProgram)
+        funcs->deleteProgram(program);
+    else
+        funcs->deleteProgram = qglfResolveDeleteProgram;
+}
+
+static void qglfResolveDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+{
+    typedef void (QGLF_APIENTRYP type_glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
+        context->getProcAddress(QLatin1String("glDeleteRenderbuffers"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->deleteRenderbuffers) {
+        funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
+            context->getProcAddress(QLatin1String("glDeleteRenderbuffersOES"));
+    }
+#endif
+    if (!funcs->deleteRenderbuffers) {
+        funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
+            context->getProcAddress(QLatin1String("glDeleteRenderbuffersEXT"));
+    }
+    if (!funcs->deleteRenderbuffers) {
+        funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
+            context->getProcAddress(QLatin1String("glDeleteRenderbuffersARB"));
+    }
+
+    if (funcs->deleteRenderbuffers)
+        funcs->deleteRenderbuffers(n, renderbuffers);
+    else
+        funcs->deleteRenderbuffers = qglfResolveDeleteRenderbuffers;
+}
+
+static void qglfResolveDeleteShader(GLuint shader)
+{
+    typedef void (QGLF_APIENTRYP type_glDeleteShader)(GLuint shader);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->deleteShader = (type_glDeleteShader)
+        context->getProcAddress(QLatin1String("glDeleteShader"));
+    if (!funcs->deleteShader) {
+        funcs->deleteShader = (type_glDeleteShader)
+            context->getProcAddress(QLatin1String("glDeleteObjectARB"));
+    }
+
+    if (funcs->deleteShader)
+        funcs->deleteShader(shader);
+    else
+        funcs->deleteShader = qglfResolveDeleteShader;
+}
+
+static void qglfResolveDetachShader(GLuint program, GLuint shader)
+{
+    typedef void (QGLF_APIENTRYP type_glDetachShader)(GLuint program, GLuint shader);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->detachShader = (type_glDetachShader)
+        context->getProcAddress(QLatin1String("glDetachShader"));
+    if (!funcs->detachShader) {
+        funcs->detachShader = (type_glDetachShader)
+            context->getProcAddress(QLatin1String("glDetachObjectARB"));
+    }
+
+    if (funcs->detachShader)
+        funcs->detachShader(program, shader);
+    else
+        funcs->detachShader = qglfResolveDetachShader;
+}
+
+static void qglfResolveDisableVertexAttribArray(GLuint index)
+{
+    typedef void (QGLF_APIENTRYP type_glDisableVertexAttribArray)(GLuint index);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->disableVertexAttribArray = (type_glDisableVertexAttribArray)
+        context->getProcAddress(QLatin1String("glDisableVertexAttribArray"));
+    if (!funcs->disableVertexAttribArray) {
+        funcs->disableVertexAttribArray = (type_glDisableVertexAttribArray)
+            context->getProcAddress(QLatin1String("glDisableVertexAttribArrayARB"));
+    }
+
+    if (funcs->disableVertexAttribArray)
+        funcs->disableVertexAttribArray(index);
+    else
+        funcs->disableVertexAttribArray = qglfResolveDisableVertexAttribArray;
+}
+
+static void qglfResolveEnableVertexAttribArray(GLuint index)
+{
+    typedef void (QGLF_APIENTRYP type_glEnableVertexAttribArray)(GLuint index);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->enableVertexAttribArray = (type_glEnableVertexAttribArray)
+        context->getProcAddress(QLatin1String("glEnableVertexAttribArray"));
+    if (!funcs->enableVertexAttribArray) {
+        funcs->enableVertexAttribArray = (type_glEnableVertexAttribArray)
+            context->getProcAddress(QLatin1String("glEnableVertexAttribArrayARB"));
+    }
+
+    if (funcs->enableVertexAttribArray)
+        funcs->enableVertexAttribArray(index);
+    else
+        funcs->enableVertexAttribArray = qglfResolveEnableVertexAttribArray;
+}
+
+static void qglfResolveFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+    typedef void (QGLF_APIENTRYP type_glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
+        context->getProcAddress(QLatin1String("glFramebufferRenderbuffer"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->framebufferRenderbuffer) {
+        funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
+            context->getProcAddress(QLatin1String("glFramebufferRenderbufferOES"));
+    }
+#endif
+    if (!funcs->framebufferRenderbuffer) {
+        funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
+            context->getProcAddress(QLatin1String("glFramebufferRenderbufferEXT"));
+    }
+    if (!funcs->framebufferRenderbuffer) {
+        funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
+            context->getProcAddress(QLatin1String("glFramebufferRenderbufferARB"));
+    }
+
+    if (funcs->framebufferRenderbuffer)
+        funcs->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+    else
+        funcs->framebufferRenderbuffer = qglfResolveFramebufferRenderbuffer;
+}
+
+static void qglfResolveFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+    typedef void (QGLF_APIENTRYP type_glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
+        context->getProcAddress(QLatin1String("glFramebufferTexture2D"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->framebufferTexture2D) {
+        funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
+            context->getProcAddress(QLatin1String("glFramebufferTexture2DOES"));
+    }
+#endif
+    if (!funcs->framebufferTexture2D) {
+        funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
+            context->getProcAddress(QLatin1String("glFramebufferTexture2DEXT"));
+    }
+    if (!funcs->framebufferTexture2D) {
+        funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
+            context->getProcAddress(QLatin1String("glFramebufferTexture2DARB"));
+    }
+
+    if (funcs->framebufferTexture2D)
+        funcs->framebufferTexture2D(target, attachment, textarget, texture, level);
+    else
+        funcs->framebufferTexture2D = qglfResolveFramebufferTexture2D;
+}
+
+static void qglfResolveGenBuffers(GLsizei n, GLuint* buffers)
+{
+    typedef void (QGLF_APIENTRYP type_glGenBuffers)(GLsizei n, GLuint* buffers);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->genBuffers = (type_glGenBuffers)
+        context->getProcAddress(QLatin1String("glGenBuffers"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->genBuffers) {
+        funcs->genBuffers = (type_glGenBuffers)
+            context->getProcAddress(QLatin1String("glGenBuffersOES"));
+    }
+#endif
+    if (!funcs->genBuffers) {
+        funcs->genBuffers = (type_glGenBuffers)
+            context->getProcAddress(QLatin1String("glGenBuffersEXT"));
+    }
+    if (!funcs->genBuffers) {
+        funcs->genBuffers = (type_glGenBuffers)
+            context->getProcAddress(QLatin1String("glGenBuffersARB"));
+    }
+
+    if (funcs->genBuffers)
+        funcs->genBuffers(n, buffers);
+    else
+        funcs->genBuffers = qglfResolveGenBuffers;
+}
+
+static void qglfResolveGenerateMipmap(GLenum target)
+{
+    typedef void (QGLF_APIENTRYP type_glGenerateMipmap)(GLenum target);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->generateMipmap = (type_glGenerateMipmap)
+        context->getProcAddress(QLatin1String("glGenerateMipmap"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->generateMipmap) {
+        funcs->generateMipmap = (type_glGenerateMipmap)
+            context->getProcAddress(QLatin1String("glGenerateMipmapOES"));
+    }
+#endif
+    if (!funcs->generateMipmap) {
+        funcs->generateMipmap = (type_glGenerateMipmap)
+            context->getProcAddress(QLatin1String("glGenerateMipmapEXT"));
+    }
+    if (!funcs->generateMipmap) {
+        funcs->generateMipmap = (type_glGenerateMipmap)
+            context->getProcAddress(QLatin1String("glGenerateMipmapARB"));
+    }
+
+    if (funcs->generateMipmap)
+        funcs->generateMipmap(target);
+    else
+        funcs->generateMipmap = qglfResolveGenerateMipmap;
+}
+
+static void qglfResolveGenFramebuffers(GLsizei n, GLuint* framebuffers)
+{
+    typedef void (QGLF_APIENTRYP type_glGenFramebuffers)(GLsizei n, GLuint* framebuffers);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->genFramebuffers = (type_glGenFramebuffers)
+        context->getProcAddress(QLatin1String("glGenFramebuffers"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->genFramebuffers) {
+        funcs->genFramebuffers = (type_glGenFramebuffers)
+            context->getProcAddress(QLatin1String("glGenFramebuffersOES"));
+    }
+#endif
+    if (!funcs->genFramebuffers) {
+        funcs->genFramebuffers = (type_glGenFramebuffers)
+            context->getProcAddress(QLatin1String("glGenFramebuffersEXT"));
+    }
+    if (!funcs->genFramebuffers) {
+        funcs->genFramebuffers = (type_glGenFramebuffers)
+            context->getProcAddress(QLatin1String("glGenFramebuffersARB"));
+    }
+
+    if (funcs->genFramebuffers)
+        funcs->genFramebuffers(n, framebuffers);
+    else
+        funcs->genFramebuffers = qglfResolveGenFramebuffers;
+}
+
+static void qglfResolveGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+{
+    typedef void (QGLF_APIENTRYP type_glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->genRenderbuffers = (type_glGenRenderbuffers)
+        context->getProcAddress(QLatin1String("glGenRenderbuffers"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->genRenderbuffers) {
+        funcs->genRenderbuffers = (type_glGenRenderbuffers)
+            context->getProcAddress(QLatin1String("glGenRenderbuffersOES"));
+    }
+#endif
+    if (!funcs->genRenderbuffers) {
+        funcs->genRenderbuffers = (type_glGenRenderbuffers)
+            context->getProcAddress(QLatin1String("glGenRenderbuffersEXT"));
+    }
+    if (!funcs->genRenderbuffers) {
+        funcs->genRenderbuffers = (type_glGenRenderbuffers)
+            context->getProcAddress(QLatin1String("glGenRenderbuffersARB"));
+    }
+
+    if (funcs->genRenderbuffers)
+        funcs->genRenderbuffers(n, renderbuffers);
+    else
+        funcs->genRenderbuffers = qglfResolveGenRenderbuffers;
+}
+
+static void qglfResolveGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+    typedef void (QGLF_APIENTRYP type_glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getActiveAttrib = (type_glGetActiveAttrib)
+        context->getProcAddress(QLatin1String("glGetActiveAttrib"));
+    if (!funcs->getActiveAttrib) {
+        funcs->getActiveAttrib = (type_glGetActiveAttrib)
+            context->getProcAddress(QLatin1String("glGetActiveAttribARB"));
+    }
+
+    if (funcs->getActiveAttrib)
+        funcs->getActiveAttrib(program, index, bufsize, length, size, type, name);
+    else
+        funcs->getActiveAttrib = qglfResolveGetActiveAttrib;
+}
+
+static void qglfResolveGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+    typedef void (QGLF_APIENTRYP type_glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getActiveUniform = (type_glGetActiveUniform)
+        context->getProcAddress(QLatin1String("glGetActiveUniform"));
+    if (!funcs->getActiveUniform) {
+        funcs->getActiveUniform = (type_glGetActiveUniform)
+            context->getProcAddress(QLatin1String("glGetActiveUniformARB"));
+    }
+
+    if (funcs->getActiveUniform)
+        funcs->getActiveUniform(program, index, bufsize, length, size, type, name);
+    else
+        funcs->getActiveUniform = qglfResolveGetActiveUniform;
+}
+
+static void qglfResolveGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+    typedef void (QGLF_APIENTRYP type_glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getAttachedShaders = (type_glGetAttachedShaders)
+        context->getProcAddress(QLatin1String("glGetAttachedShaders"));
+    if (!funcs->getAttachedShaders) {
+        funcs->getAttachedShaders = (type_glGetAttachedShaders)
+            context->getProcAddress(QLatin1String("glGetAttachedObjectsARB"));
+    }
+
+    if (funcs->getAttachedShaders)
+        funcs->getAttachedShaders(program, maxcount, count, shaders);
+    else
+        funcs->getAttachedShaders = qglfResolveGetAttachedShaders;
+}
+
+static int qglfResolveGetAttribLocation(GLuint program, const char* name)
+{
+    typedef int (QGLF_APIENTRYP type_glGetAttribLocation)(GLuint program, const char* name);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getAttribLocation = (type_glGetAttribLocation)
+        context->getProcAddress(QLatin1String("glGetAttribLocation"));
+    if (!funcs->getAttribLocation) {
+        funcs->getAttribLocation = (type_glGetAttribLocation)
+            context->getProcAddress(QLatin1String("glGetAttribLocationARB"));
+    }
+
+    if (funcs->getAttribLocation)
+        return funcs->getAttribLocation(program, name);
+    funcs->getAttribLocation = qglfResolveGetAttribLocation;
+    return int(0);
+}
+
+static void qglfResolveGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
+        context->getProcAddress(QLatin1String("glGetBufferParameteriv"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->getBufferParameteriv) {
+        funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
+            context->getProcAddress(QLatin1String("glGetBufferParameterivOES"));
+    }
+#endif
+    if (!funcs->getBufferParameteriv) {
+        funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
+            context->getProcAddress(QLatin1String("glGetBufferParameterivEXT"));
+    }
+    if (!funcs->getBufferParameteriv) {
+        funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
+            context->getProcAddress(QLatin1String("glGetBufferParameterivARB"));
+    }
+
+    if (funcs->getBufferParameteriv)
+        funcs->getBufferParameteriv(target, pname, params);
+    else
+        funcs->getBufferParameteriv = qglfResolveGetBufferParameteriv;
+}
+
+static void qglfResolveGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
+        context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameteriv"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->getFramebufferAttachmentParameteriv) {
+        funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
+            context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivOES"));
+    }
+#endif
+    if (!funcs->getFramebufferAttachmentParameteriv) {
+        funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
+            context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivEXT"));
+    }
+    if (!funcs->getFramebufferAttachmentParameteriv) {
+        funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
+            context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivARB"));
+    }
+
+    if (funcs->getFramebufferAttachmentParameteriv)
+        funcs->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
+    else
+        funcs->getFramebufferAttachmentParameteriv = qglfResolveGetFramebufferAttachmentParameteriv;
+}
+
+static void qglfResolveGetProgramiv(GLuint program, GLenum pname, GLint* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetProgramiv)(GLuint program, GLenum pname, GLint* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getProgramiv = (type_glGetProgramiv)
+        context->getProcAddress(QLatin1String("glGetProgramiv"));
+    if (!funcs->getProgramiv) {
+        funcs->getProgramiv = (type_glGetProgramiv)
+            context->getProcAddress(QLatin1String("glGetObjectParameterivARB"));
+    }
+
+    if (funcs->getProgramiv)
+        funcs->getProgramiv(program, pname, params);
+    else
+        funcs->getProgramiv = qglfResolveGetProgramiv;
+}
+
+static void qglfResolveGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+    typedef void (QGLF_APIENTRYP type_glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getProgramInfoLog = (type_glGetProgramInfoLog)
+        context->getProcAddress(QLatin1String("glGetProgramInfoLog"));
+    if (!funcs->getProgramInfoLog) {
+        funcs->getProgramInfoLog = (type_glGetProgramInfoLog)
+            context->getProcAddress(QLatin1String("glGetInfoLogARB"));
+    }
+
+    if (funcs->getProgramInfoLog)
+        funcs->getProgramInfoLog(program, bufsize, length, infolog);
+    else
+        funcs->getProgramInfoLog = qglfResolveGetProgramInfoLog;
+}
+
+static void qglfResolveGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
+        context->getProcAddress(QLatin1String("glGetRenderbufferParameteriv"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->getRenderbufferParameteriv) {
+        funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
+            context->getProcAddress(QLatin1String("glGetRenderbufferParameterivOES"));
+    }
+#endif
+    if (!funcs->getRenderbufferParameteriv) {
+        funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
+            context->getProcAddress(QLatin1String("glGetRenderbufferParameterivEXT"));
+    }
+    if (!funcs->getRenderbufferParameteriv) {
+        funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
+            context->getProcAddress(QLatin1String("glGetRenderbufferParameterivARB"));
+    }
+
+    if (funcs->getRenderbufferParameteriv)
+        funcs->getRenderbufferParameteriv(target, pname, params);
+    else
+        funcs->getRenderbufferParameteriv = qglfResolveGetRenderbufferParameteriv;
+}
+
+static void qglfResolveGetShaderiv(GLuint shader, GLenum pname, GLint* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetShaderiv)(GLuint shader, GLenum pname, GLint* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getShaderiv = (type_glGetShaderiv)
+        context->getProcAddress(QLatin1String("glGetShaderiv"));
+    if (!funcs->getShaderiv) {
+        funcs->getShaderiv = (type_glGetShaderiv)
+            context->getProcAddress(QLatin1String("glGetObjectParameterivARB"));
+    }
+
+    if (funcs->getShaderiv)
+        funcs->getShaderiv(shader, pname, params);
+    else
+        funcs->getShaderiv = qglfResolveGetShaderiv;
+}
+
+static void qglfResolveGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+    typedef void (QGLF_APIENTRYP type_glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getShaderInfoLog = (type_glGetShaderInfoLog)
+        context->getProcAddress(QLatin1String("glGetShaderInfoLog"));
+    if (!funcs->getShaderInfoLog) {
+        funcs->getShaderInfoLog = (type_glGetShaderInfoLog)
+            context->getProcAddress(QLatin1String("glGetInfoLogARB"));
+    }
+
+    if (funcs->getShaderInfoLog)
+        funcs->getShaderInfoLog(shader, bufsize, length, infolog);
+    else
+        funcs->getShaderInfoLog = qglfResolveGetShaderInfoLog;
+}
+
+static void qglfSpecialGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+    Q_UNUSED(shadertype);
+    Q_UNUSED(precisiontype);
+    range[0] = range[1] = precision[0] = 0;
+}
+
+static void qglfResolveGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+    typedef void (QGLF_APIENTRYP type_glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
+        context->getProcAddress(QLatin1String("glGetShaderPrecisionFormat"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->getShaderPrecisionFormat) {
+        funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
+            context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatOES"));
+    }
+#endif
+    if (!funcs->getShaderPrecisionFormat) {
+        funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
+            context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatEXT"));
+    }
+    if (!funcs->getShaderPrecisionFormat) {
+        funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
+            context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatARB"));
+    }
+
+    if (!funcs->getShaderPrecisionFormat)
+        funcs->getShaderPrecisionFormat = qglfSpecialGetShaderPrecisionFormat;
+
+    funcs->getShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+}
+
+static void qglfResolveGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+{
+    typedef void (QGLF_APIENTRYP type_glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getShaderSource = (type_glGetShaderSource)
+        context->getProcAddress(QLatin1String("glGetShaderSource"));
+    if (!funcs->getShaderSource) {
+        funcs->getShaderSource = (type_glGetShaderSource)
+            context->getProcAddress(QLatin1String("glGetShaderSourceARB"));
+    }
+
+    if (funcs->getShaderSource)
+        funcs->getShaderSource(shader, bufsize, length, source);
+    else
+        funcs->getShaderSource = qglfResolveGetShaderSource;
+}
+
+static void qglfResolveGetUniformfv(GLuint program, GLint location, GLfloat* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetUniformfv)(GLuint program, GLint location, GLfloat* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getUniformfv = (type_glGetUniformfv)
+        context->getProcAddress(QLatin1String("glGetUniformfv"));
+    if (!funcs->getUniformfv) {
+        funcs->getUniformfv = (type_glGetUniformfv)
+            context->getProcAddress(QLatin1String("glGetUniformfvARB"));
+    }
+
+    if (funcs->getUniformfv)
+        funcs->getUniformfv(program, location, params);
+    else
+        funcs->getUniformfv = qglfResolveGetUniformfv;
+}
+
+static void qglfResolveGetUniformiv(GLuint program, GLint location, GLint* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetUniformiv)(GLuint program, GLint location, GLint* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getUniformiv = (type_glGetUniformiv)
+        context->getProcAddress(QLatin1String("glGetUniformiv"));
+    if (!funcs->getUniformiv) {
+        funcs->getUniformiv = (type_glGetUniformiv)
+            context->getProcAddress(QLatin1String("glGetUniformivARB"));
+    }
+
+    if (funcs->getUniformiv)
+        funcs->getUniformiv(program, location, params);
+    else
+        funcs->getUniformiv = qglfResolveGetUniformiv;
+}
+
+static int qglfResolveGetUniformLocation(GLuint program, const char* name)
+{
+    typedef int (QGLF_APIENTRYP type_glGetUniformLocation)(GLuint program, const char* name);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getUniformLocation = (type_glGetUniformLocation)
+        context->getProcAddress(QLatin1String("glGetUniformLocation"));
+    if (!funcs->getUniformLocation) {
+        funcs->getUniformLocation = (type_glGetUniformLocation)
+            context->getProcAddress(QLatin1String("glGetUniformLocationARB"));
+    }
+
+    if (funcs->getUniformLocation)
+        return funcs->getUniformLocation(program, name);
+    funcs->getUniformLocation = qglfResolveGetUniformLocation;
+    return int(0);
+}
+
+static void qglfResolveGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getVertexAttribfv = (type_glGetVertexAttribfv)
+        context->getProcAddress(QLatin1String("glGetVertexAttribfv"));
+    if (!funcs->getVertexAttribfv) {
+        funcs->getVertexAttribfv = (type_glGetVertexAttribfv)
+            context->getProcAddress(QLatin1String("glGetVertexAttribfvARB"));
+    }
+
+    if (funcs->getVertexAttribfv)
+        funcs->getVertexAttribfv(index, pname, params);
+    else
+        funcs->getVertexAttribfv = qglfResolveGetVertexAttribfv;
+}
+
+static void qglfResolveGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+{
+    typedef void (QGLF_APIENTRYP type_glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getVertexAttribiv = (type_glGetVertexAttribiv)
+        context->getProcAddress(QLatin1String("glGetVertexAttribiv"));
+    if (!funcs->getVertexAttribiv) {
+        funcs->getVertexAttribiv = (type_glGetVertexAttribiv)
+            context->getProcAddress(QLatin1String("glGetVertexAttribivARB"));
+    }
+
+    if (funcs->getVertexAttribiv)
+        funcs->getVertexAttribiv(index, pname, params);
+    else
+        funcs->getVertexAttribiv = qglfResolveGetVertexAttribiv;
+}
+
+static void qglfResolveGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
+{
+    typedef void (QGLF_APIENTRYP type_glGetVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->getVertexAttribPointerv = (type_glGetVertexAttribPointerv)
+        context->getProcAddress(QLatin1String("glGetVertexAttribPointerv"));
+    if (!funcs->getVertexAttribPointerv) {
+        funcs->getVertexAttribPointerv = (type_glGetVertexAttribPointerv)
+            context->getProcAddress(QLatin1String("glGetVertexAttribPointervARB"));
+    }
+
+    if (funcs->getVertexAttribPointerv)
+        funcs->getVertexAttribPointerv(index, pname, pointer);
+    else
+        funcs->getVertexAttribPointerv = qglfResolveGetVertexAttribPointerv;
+}
+
+static GLboolean qglfResolveIsBuffer(GLuint buffer)
+{
+    typedef GLboolean (QGLF_APIENTRYP type_glIsBuffer)(GLuint buffer);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->isBuffer = (type_glIsBuffer)
+        context->getProcAddress(QLatin1String("glIsBuffer"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->isBuffer) {
+        funcs->isBuffer = (type_glIsBuffer)
+            context->getProcAddress(QLatin1String("glIsBufferOES"));
+    }
+#endif
+    if (!funcs->isBuffer) {
+        funcs->isBuffer = (type_glIsBuffer)
+            context->getProcAddress(QLatin1String("glIsBufferEXT"));
+    }
+    if (!funcs->isBuffer) {
+        funcs->isBuffer = (type_glIsBuffer)
+            context->getProcAddress(QLatin1String("glIsBufferARB"));
+    }
+
+    if (funcs->isBuffer)
+        return funcs->isBuffer(buffer);
+    funcs->isBuffer = qglfResolveIsBuffer;
+    return GLboolean(0);
+}
+
+static GLboolean qglfResolveIsFramebuffer(GLuint framebuffer)
+{
+    typedef GLboolean (QGLF_APIENTRYP type_glIsFramebuffer)(GLuint framebuffer);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->isFramebuffer = (type_glIsFramebuffer)
+        context->getProcAddress(QLatin1String("glIsFramebuffer"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->isFramebuffer) {
+        funcs->isFramebuffer = (type_glIsFramebuffer)
+            context->getProcAddress(QLatin1String("glIsFramebufferOES"));
+    }
+#endif
+    if (!funcs->isFramebuffer) {
+        funcs->isFramebuffer = (type_glIsFramebuffer)
+            context->getProcAddress(QLatin1String("glIsFramebufferEXT"));
+    }
+    if (!funcs->isFramebuffer) {
+        funcs->isFramebuffer = (type_glIsFramebuffer)
+            context->getProcAddress(QLatin1String("glIsFramebufferARB"));
+    }
+
+    if (funcs->isFramebuffer)
+        return funcs->isFramebuffer(framebuffer);
+    funcs->isFramebuffer = qglfResolveIsFramebuffer;
+    return GLboolean(0);
+}
+
+static GLboolean qglfSpecialIsProgram(GLuint program)
+{
+    return program != 0;
+}
+
+static GLboolean qglfResolveIsProgram(GLuint program)
+{
+    typedef GLboolean (QGLF_APIENTRYP type_glIsProgram)(GLuint program);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->isProgram = (type_glIsProgram)
+        context->getProcAddress(QLatin1String("glIsProgram"));
+    if (!funcs->isProgram) {
+        funcs->isProgram = (type_glIsProgram)
+            context->getProcAddress(QLatin1String("glIsProgramARB"));
+    }
+
+    if (!funcs->isProgram)
+        funcs->isProgram = qglfSpecialIsProgram;
+
+    return funcs->isProgram(program);
+}
+
+static GLboolean qglfResolveIsRenderbuffer(GLuint renderbuffer)
+{
+    typedef GLboolean (QGLF_APIENTRYP type_glIsRenderbuffer)(GLuint renderbuffer);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->isRenderbuffer = (type_glIsRenderbuffer)
+        context->getProcAddress(QLatin1String("glIsRenderbuffer"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->isRenderbuffer) {
+        funcs->isRenderbuffer = (type_glIsRenderbuffer)
+            context->getProcAddress(QLatin1String("glIsRenderbufferOES"));
+    }
+#endif
+    if (!funcs->isRenderbuffer) {
+        funcs->isRenderbuffer = (type_glIsRenderbuffer)
+            context->getProcAddress(QLatin1String("glIsRenderbufferEXT"));
+    }
+    if (!funcs->isRenderbuffer) {
+        funcs->isRenderbuffer = (type_glIsRenderbuffer)
+            context->getProcAddress(QLatin1String("glIsRenderbufferARB"));
+    }
+
+    if (funcs->isRenderbuffer)
+        return funcs->isRenderbuffer(renderbuffer);
+    funcs->isRenderbuffer = qglfResolveIsRenderbuffer;
+    return GLboolean(0);
+}
+
+static GLboolean qglfSpecialIsShader(GLuint shader)
+{
+    return shader != 0;
+}
+
+static GLboolean qglfResolveIsShader(GLuint shader)
+{
+    typedef GLboolean (QGLF_APIENTRYP type_glIsShader)(GLuint shader);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->isShader = (type_glIsShader)
+        context->getProcAddress(QLatin1String("glIsShader"));
+    if (!funcs->isShader) {
+        funcs->isShader = (type_glIsShader)
+            context->getProcAddress(QLatin1String("glIsShaderARB"));
+    }
+
+    if (!funcs->isShader)
+        funcs->isShader = qglfSpecialIsShader;
+
+    return funcs->isShader(shader);
+}
+
+static void qglfResolveLinkProgram(GLuint program)
+{
+    typedef void (QGLF_APIENTRYP type_glLinkProgram)(GLuint program);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->linkProgram = (type_glLinkProgram)
+        context->getProcAddress(QLatin1String("glLinkProgram"));
+    if (!funcs->linkProgram) {
+        funcs->linkProgram = (type_glLinkProgram)
+            context->getProcAddress(QLatin1String("glLinkProgramARB"));
+    }
+
+    if (funcs->linkProgram)
+        funcs->linkProgram(program);
+    else
+        funcs->linkProgram = qglfResolveLinkProgram;
+}
+
+static void qglfSpecialReleaseShaderCompiler()
+{
+}
+
+static void qglfResolveReleaseShaderCompiler()
+{
+    typedef void (QGLF_APIENTRYP type_glReleaseShaderCompiler)();
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->releaseShaderCompiler = (type_glReleaseShaderCompiler)
+        context->getProcAddress(QLatin1String("glReleaseShaderCompiler"));
+    if (!funcs->releaseShaderCompiler) {
+        funcs->releaseShaderCompiler = (type_glReleaseShaderCompiler)
+            context->getProcAddress(QLatin1String("glReleaseShaderCompilerARB"));
+    }
+
+    if (!funcs->releaseShaderCompiler)
+        funcs->releaseShaderCompiler = qglfSpecialReleaseShaderCompiler;
+
+    funcs->releaseShaderCompiler();
+}
+
+static void qglfResolveRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+    typedef void (QGLF_APIENTRYP type_glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->renderbufferStorage = (type_glRenderbufferStorage)
+        context->getProcAddress(QLatin1String("glRenderbufferStorage"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->renderbufferStorage) {
+        funcs->renderbufferStorage = (type_glRenderbufferStorage)
+            context->getProcAddress(QLatin1String("glRenderbufferStorageOES"));
+    }
+#endif
+    if (!funcs->renderbufferStorage) {
+        funcs->renderbufferStorage = (type_glRenderbufferStorage)
+            context->getProcAddress(QLatin1String("glRenderbufferStorageEXT"));
+    }
+    if (!funcs->renderbufferStorage) {
+        funcs->renderbufferStorage = (type_glRenderbufferStorage)
+            context->getProcAddress(QLatin1String("glRenderbufferStorageARB"));
+    }
+
+    if (funcs->renderbufferStorage)
+        funcs->renderbufferStorage(target, internalformat, width, height);
+    else
+        funcs->renderbufferStorage = qglfResolveRenderbufferStorage;
+}
+
+static void qglfResolveSampleCoverage(GLclampf value, GLboolean invert)
+{
+    typedef void (QGLF_APIENTRYP type_glSampleCoverage)(GLclampf value, GLboolean invert);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->sampleCoverage = (type_glSampleCoverage)
+        context->getProcAddress(QLatin1String("glSampleCoverage"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->sampleCoverage) {
+        funcs->sampleCoverage = (type_glSampleCoverage)
+            context->getProcAddress(QLatin1String("glSampleCoverageOES"));
+    }
+#endif
+    if (!funcs->sampleCoverage) {
+        funcs->sampleCoverage = (type_glSampleCoverage)
+            context->getProcAddress(QLatin1String("glSampleCoverageEXT"));
+    }
+    if (!funcs->sampleCoverage) {
+        funcs->sampleCoverage = (type_glSampleCoverage)
+            context->getProcAddress(QLatin1String("glSampleCoverageARB"));
+    }
+
+    if (funcs->sampleCoverage)
+        funcs->sampleCoverage(value, invert);
+    else
+        funcs->sampleCoverage = qglfResolveSampleCoverage;
+}
+
+static void qglfResolveShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
+{
+    typedef void (QGLF_APIENTRYP type_glShaderBinary)(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->shaderBinary = (type_glShaderBinary)
+        context->getProcAddress(QLatin1String("glShaderBinary"));
+    if (!funcs->shaderBinary) {
+        funcs->shaderBinary = (type_glShaderBinary)
+            context->getProcAddress(QLatin1String("glShaderBinaryARB"));
+    }
+
+    if (funcs->shaderBinary)
+        funcs->shaderBinary(n, shaders, binaryformat, binary, length);
+    else
+        funcs->shaderBinary = qglfResolveShaderBinary;
+}
+
+static void qglfResolveShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
+{
+    typedef void (QGLF_APIENTRYP type_glShaderSource)(GLuint shader, GLsizei count, const char** string, const GLint* length);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->shaderSource = (type_glShaderSource)
+        context->getProcAddress(QLatin1String("glShaderSource"));
+    if (!funcs->shaderSource) {
+        funcs->shaderSource = (type_glShaderSource)
+            context->getProcAddress(QLatin1String("glShaderSourceARB"));
+    }
+
+    if (funcs->shaderSource)
+        funcs->shaderSource(shader, count, string, length);
+    else
+        funcs->shaderSource = qglfResolveShaderSource;
+}
+
+static void qglfResolveStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+    typedef void (QGLF_APIENTRYP type_glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
+        context->getProcAddress(QLatin1String("glStencilFuncSeparate"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->stencilFuncSeparate) {
+        funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
+            context->getProcAddress(QLatin1String("glStencilFuncSeparateOES"));
+    }
+#endif
+    if (!funcs->stencilFuncSeparate) {
+        funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
+            context->getProcAddress(QLatin1String("glStencilFuncSeparateEXT"));
+    }
+    if (!funcs->stencilFuncSeparate) {
+        funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
+            context->getProcAddress(QLatin1String("glStencilFuncSeparateARB"));
+    }
+
+    if (funcs->stencilFuncSeparate)
+        funcs->stencilFuncSeparate(face, func, ref, mask);
+    else
+        funcs->stencilFuncSeparate = qglfResolveStencilFuncSeparate;
+}
+
+static void qglfResolveStencilMaskSeparate(GLenum face, GLuint mask)
+{
+    typedef void (QGLF_APIENTRYP type_glStencilMaskSeparate)(GLenum face, GLuint mask);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
+        context->getProcAddress(QLatin1String("glStencilMaskSeparate"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->stencilMaskSeparate) {
+        funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
+            context->getProcAddress(QLatin1String("glStencilMaskSeparateOES"));
+    }
+#endif
+    if (!funcs->stencilMaskSeparate) {
+        funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
+            context->getProcAddress(QLatin1String("glStencilMaskSeparateEXT"));
+    }
+    if (!funcs->stencilMaskSeparate) {
+        funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
+            context->getProcAddress(QLatin1String("glStencilMaskSeparateARB"));
+    }
+
+    if (funcs->stencilMaskSeparate)
+        funcs->stencilMaskSeparate(face, mask);
+    else
+        funcs->stencilMaskSeparate = qglfResolveStencilMaskSeparate;
+}
+
+static void qglfResolveStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+    typedef void (QGLF_APIENTRYP type_glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->stencilOpSeparate = (type_glStencilOpSeparate)
+        context->getProcAddress(QLatin1String("glStencilOpSeparate"));
+#ifdef QT_OPENGL_ES
+    if (!funcs->stencilOpSeparate) {
+        funcs->stencilOpSeparate = (type_glStencilOpSeparate)
+            context->getProcAddress(QLatin1String("glStencilOpSeparateOES"));
+    }
+#endif
+    if (!funcs->stencilOpSeparate) {
+        funcs->stencilOpSeparate = (type_glStencilOpSeparate)
+            context->getProcAddress(QLatin1String("glStencilOpSeparateEXT"));
+    }
+    if (!funcs->stencilOpSeparate) {
+        funcs->stencilOpSeparate = (type_glStencilOpSeparate)
+            context->getProcAddress(QLatin1String("glStencilOpSeparateARB"));
+    }
+
+    if (funcs->stencilOpSeparate)
+        funcs->stencilOpSeparate(face, fail, zfail, zpass);
+    else
+        funcs->stencilOpSeparate = qglfResolveStencilOpSeparate;
+}
+
+static void qglfResolveUniform1f(GLint location, GLfloat x)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform1f)(GLint location, GLfloat x);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform1f = (type_glUniform1f)
+        context->getProcAddress(QLatin1String("glUniform1f"));
+    if (!funcs->uniform1f) {
+        funcs->uniform1f = (type_glUniform1f)
+            context->getProcAddress(QLatin1String("glUniform1fARB"));
+    }
+
+    if (funcs->uniform1f)
+        funcs->uniform1f(location, x);
+    else
+        funcs->uniform1f = qglfResolveUniform1f;
+}
+
+static void qglfResolveUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform1fv)(GLint location, GLsizei count, const GLfloat* v);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform1fv = (type_glUniform1fv)
+        context->getProcAddress(QLatin1String("glUniform1fv"));
+    if (!funcs->uniform1fv) {
+        funcs->uniform1fv = (type_glUniform1fv)
+            context->getProcAddress(QLatin1String("glUniform1fvARB"));
+    }
+
+    if (funcs->uniform1fv)
+        funcs->uniform1fv(location, count, v);
+    else
+        funcs->uniform1fv = qglfResolveUniform1fv;
+}
+
+static void qglfResolveUniform1i(GLint location, GLint x)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform1i)(GLint location, GLint x);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform1i = (type_glUniform1i)
+        context->getProcAddress(QLatin1String("glUniform1i"));
+    if (!funcs->uniform1i) {
+        funcs->uniform1i = (type_glUniform1i)
+            context->getProcAddress(QLatin1String("glUniform1iARB"));
+    }
+
+    if (funcs->uniform1i)
+        funcs->uniform1i(location, x);
+    else
+        funcs->uniform1i = qglfResolveUniform1i;
+}
+
+static void qglfResolveUniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform1iv)(GLint location, GLsizei count, const GLint* v);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform1iv = (type_glUniform1iv)
+        context->getProcAddress(QLatin1String("glUniform1iv"));
+    if (!funcs->uniform1iv) {
+        funcs->uniform1iv = (type_glUniform1iv)
+            context->getProcAddress(QLatin1String("glUniform1ivARB"));
+    }
+
+    if (funcs->uniform1iv)
+        funcs->uniform1iv(location, count, v);
+    else
+        funcs->uniform1iv = qglfResolveUniform1iv;
+}
+
+static void qglfResolveUniform2f(GLint location, GLfloat x, GLfloat y)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform2f)(GLint location, GLfloat x, GLfloat y);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform2f = (type_glUniform2f)
+        context->getProcAddress(QLatin1String("glUniform2f"));
+    if (!funcs->uniform2f) {
+        funcs->uniform2f = (type_glUniform2f)
+            context->getProcAddress(QLatin1String("glUniform2fARB"));
+    }
+
+    if (funcs->uniform2f)
+        funcs->uniform2f(location, x, y);
+    else
+        funcs->uniform2f = qglfResolveUniform2f;
+}
+
+static void qglfResolveUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform2fv)(GLint location, GLsizei count, const GLfloat* v);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform2fv = (type_glUniform2fv)
+        context->getProcAddress(QLatin1String("glUniform2fv"));
+    if (!funcs->uniform2fv) {
+        funcs->uniform2fv = (type_glUniform2fv)
+            context->getProcAddress(QLatin1String("glUniform2fvARB"));
+    }
+
+    if (funcs->uniform2fv)
+        funcs->uniform2fv(location, count, v);
+    else
+        funcs->uniform2fv = qglfResolveUniform2fv;
+}
+
+static void qglfResolveUniform2i(GLint location, GLint x, GLint y)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform2i)(GLint location, GLint x, GLint y);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform2i = (type_glUniform2i)
+        context->getProcAddress(QLatin1String("glUniform2i"));
+    if (!funcs->uniform2i) {
+        funcs->uniform2i = (type_glUniform2i)
+            context->getProcAddress(QLatin1String("glUniform2iARB"));
+    }
+
+    if (funcs->uniform2i)
+        funcs->uniform2i(location, x, y);
+    else
+        funcs->uniform2i = qglfResolveUniform2i;
+}
+
+static void qglfResolveUniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform2iv)(GLint location, GLsizei count, const GLint* v);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform2iv = (type_glUniform2iv)
+        context->getProcAddress(QLatin1String("glUniform2iv"));
+    if (!funcs->uniform2iv) {
+        funcs->uniform2iv = (type_glUniform2iv)
+            context->getProcAddress(QLatin1String("glUniform2ivARB"));
+    }
+
+    if (funcs->uniform2iv)
+        funcs->uniform2iv(location, count, v);
+    else
+        funcs->uniform2iv = qglfResolveUniform2iv;
+}
+
+static void qglfResolveUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform3f = (type_glUniform3f)
+        context->getProcAddress(QLatin1String("glUniform3f"));
+    if (!funcs->uniform3f) {
+        funcs->uniform3f = (type_glUniform3f)
+            context->getProcAddress(QLatin1String("glUniform3fARB"));
+    }
+
+    if (funcs->uniform3f)
+        funcs->uniform3f(location, x, y, z);
+    else
+        funcs->uniform3f = qglfResolveUniform3f;
+}
+
+static void qglfResolveUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform3fv)(GLint location, GLsizei count, const GLfloat* v);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform3fv = (type_glUniform3fv)
+        context->getProcAddress(QLatin1String("glUniform3fv"));
+    if (!funcs->uniform3fv) {
+        funcs->uniform3fv = (type_glUniform3fv)
+            context->getProcAddress(QLatin1String("glUniform3fvARB"));
+    }
+
+    if (funcs->uniform3fv)
+        funcs->uniform3fv(location, count, v);
+    else
+        funcs->uniform3fv = qglfResolveUniform3fv;
+}
+
+static void qglfResolveUniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform3i)(GLint location, GLint x, GLint y, GLint z);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform3i = (type_glUniform3i)
+        context->getProcAddress(QLatin1String("glUniform3i"));
+    if (!funcs->uniform3i) {
+        funcs->uniform3i = (type_glUniform3i)
+            context->getProcAddress(QLatin1String("glUniform3iARB"));
+    }
+
+    if (funcs->uniform3i)
+        funcs->uniform3i(location, x, y, z);
+    else
+        funcs->uniform3i = qglfResolveUniform3i;
+}
+
+static void qglfResolveUniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform3iv)(GLint location, GLsizei count, const GLint* v);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform3iv = (type_glUniform3iv)
+        context->getProcAddress(QLatin1String("glUniform3iv"));
+    if (!funcs->uniform3iv) {
+        funcs->uniform3iv = (type_glUniform3iv)
+            context->getProcAddress(QLatin1String("glUniform3ivARB"));
+    }
+
+    if (funcs->uniform3iv)
+        funcs->uniform3iv(location, count, v);
+    else
+        funcs->uniform3iv = qglfResolveUniform3iv;
+}
+
+static void qglfResolveUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform4f = (type_glUniform4f)
+        context->getProcAddress(QLatin1String("glUniform4f"));
+    if (!funcs->uniform4f) {
+        funcs->uniform4f = (type_glUniform4f)
+            context->getProcAddress(QLatin1String("glUniform4fARB"));
+    }
+
+    if (funcs->uniform4f)
+        funcs->uniform4f(location, x, y, z, w);
+    else
+        funcs->uniform4f = qglfResolveUniform4f;
+}
+
+static void qglfResolveUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform4fv)(GLint location, GLsizei count, const GLfloat* v);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform4fv = (type_glUniform4fv)
+        context->getProcAddress(QLatin1String("glUniform4fv"));
+    if (!funcs->uniform4fv) {
+        funcs->uniform4fv = (type_glUniform4fv)
+            context->getProcAddress(QLatin1String("glUniform4fvARB"));
+    }
+
+    if (funcs->uniform4fv)
+        funcs->uniform4fv(location, count, v);
+    else
+        funcs->uniform4fv = qglfResolveUniform4fv;
+}
+
+static void qglfResolveUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform4i = (type_glUniform4i)
+        context->getProcAddress(QLatin1String("glUniform4i"));
+    if (!funcs->uniform4i) {
+        funcs->uniform4i = (type_glUniform4i)
+            context->getProcAddress(QLatin1String("glUniform4iARB"));
+    }
+
+    if (funcs->uniform4i)
+        funcs->uniform4i(location, x, y, z, w);
+    else
+        funcs->uniform4i = qglfResolveUniform4i;
+}
+
+static void qglfResolveUniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+    typedef void (QGLF_APIENTRYP type_glUniform4iv)(GLint location, GLsizei count, const GLint* v);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniform4iv = (type_glUniform4iv)
+        context->getProcAddress(QLatin1String("glUniform4iv"));
+    if (!funcs->uniform4iv) {
+        funcs->uniform4iv = (type_glUniform4iv)
+            context->getProcAddress(QLatin1String("glUniform4ivARB"));
+    }
+
+    if (funcs->uniform4iv)
+        funcs->uniform4iv(location, count, v);
+    else
+        funcs->uniform4iv = qglfResolveUniform4iv;
+}
+
+static void qglfResolveUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    typedef void (QGLF_APIENTRYP type_glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniformMatrix2fv = (type_glUniformMatrix2fv)
+        context->getProcAddress(QLatin1String("glUniformMatrix2fv"));
+    if (!funcs->uniformMatrix2fv) {
+        funcs->uniformMatrix2fv = (type_glUniformMatrix2fv)
+            context->getProcAddress(QLatin1String("glUniformMatrix2fvARB"));
+    }
+
+    if (funcs->uniformMatrix2fv)
+        funcs->uniformMatrix2fv(location, count, transpose, value);
+    else
+        funcs->uniformMatrix2fv = qglfResolveUniformMatrix2fv;
+}
+
+static void qglfResolveUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    typedef void (QGLF_APIENTRYP type_glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniformMatrix3fv = (type_glUniformMatrix3fv)
+        context->getProcAddress(QLatin1String("glUniformMatrix3fv"));
+    if (!funcs->uniformMatrix3fv) {
+        funcs->uniformMatrix3fv = (type_glUniformMatrix3fv)
+            context->getProcAddress(QLatin1String("glUniformMatrix3fvARB"));
+    }
+
+    if (funcs->uniformMatrix3fv)
+        funcs->uniformMatrix3fv(location, count, transpose, value);
+    else
+        funcs->uniformMatrix3fv = qglfResolveUniformMatrix3fv;
+}
+
+static void qglfResolveUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    typedef void (QGLF_APIENTRYP type_glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->uniformMatrix4fv = (type_glUniformMatrix4fv)
+        context->getProcAddress(QLatin1String("glUniformMatrix4fv"));
+    if (!funcs->uniformMatrix4fv) {
+        funcs->uniformMatrix4fv = (type_glUniformMatrix4fv)
+            context->getProcAddress(QLatin1String("glUniformMatrix4fvARB"));
+    }
+
+    if (funcs->uniformMatrix4fv)
+        funcs->uniformMatrix4fv(location, count, transpose, value);
+    else
+        funcs->uniformMatrix4fv = qglfResolveUniformMatrix4fv;
+}
+
+static void qglfResolveUseProgram(GLuint program)
+{
+    typedef void (QGLF_APIENTRYP type_glUseProgram)(GLuint program);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->useProgram = (type_glUseProgram)
+        context->getProcAddress(QLatin1String("glUseProgram"));
+    if (!funcs->useProgram) {
+        funcs->useProgram = (type_glUseProgram)
+            context->getProcAddress(QLatin1String("glUseProgramObjectARB"));
+    }
+
+    if (funcs->useProgram)
+        funcs->useProgram(program);
+    else
+        funcs->useProgram = qglfResolveUseProgram;
+}
+
+static void qglfResolveValidateProgram(GLuint program)
+{
+    typedef void (QGLF_APIENTRYP type_glValidateProgram)(GLuint program);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->validateProgram = (type_glValidateProgram)
+        context->getProcAddress(QLatin1String("glValidateProgram"));
+    if (!funcs->validateProgram) {
+        funcs->validateProgram = (type_glValidateProgram)
+            context->getProcAddress(QLatin1String("glValidateProgramARB"));
+    }
+
+    if (funcs->validateProgram)
+        funcs->validateProgram(program);
+    else
+        funcs->validateProgram = qglfResolveValidateProgram;
+}
+
+static void qglfResolveVertexAttrib1f(GLuint indx, GLfloat x)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttrib1f)(GLuint indx, GLfloat x);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttrib1f = (type_glVertexAttrib1f)
+        context->getProcAddress(QLatin1String("glVertexAttrib1f"));
+    if (!funcs->vertexAttrib1f) {
+        funcs->vertexAttrib1f = (type_glVertexAttrib1f)
+            context->getProcAddress(QLatin1String("glVertexAttrib1fARB"));
+    }
+
+    if (funcs->vertexAttrib1f)
+        funcs->vertexAttrib1f(indx, x);
+    else
+        funcs->vertexAttrib1f = qglfResolveVertexAttrib1f;
+}
+
+static void qglfResolveVertexAttrib1fv(GLuint indx, const GLfloat* values)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttrib1fv)(GLuint indx, const GLfloat* values);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttrib1fv = (type_glVertexAttrib1fv)
+        context->getProcAddress(QLatin1String("glVertexAttrib1fv"));
+    if (!funcs->vertexAttrib1fv) {
+        funcs->vertexAttrib1fv = (type_glVertexAttrib1fv)
+            context->getProcAddress(QLatin1String("glVertexAttrib1fvARB"));
+    }
+
+    if (funcs->vertexAttrib1fv)
+        funcs->vertexAttrib1fv(indx, values);
+    else
+        funcs->vertexAttrib1fv = qglfResolveVertexAttrib1fv;
+}
+
+static void qglfResolveVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttrib2f = (type_glVertexAttrib2f)
+        context->getProcAddress(QLatin1String("glVertexAttrib2f"));
+    if (!funcs->vertexAttrib2f) {
+        funcs->vertexAttrib2f = (type_glVertexAttrib2f)
+            context->getProcAddress(QLatin1String("glVertexAttrib2fARB"));
+    }
+
+    if (funcs->vertexAttrib2f)
+        funcs->vertexAttrib2f(indx, x, y);
+    else
+        funcs->vertexAttrib2f = qglfResolveVertexAttrib2f;
+}
+
+static void qglfResolveVertexAttrib2fv(GLuint indx, const GLfloat* values)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttrib2fv)(GLuint indx, const GLfloat* values);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttrib2fv = (type_glVertexAttrib2fv)
+        context->getProcAddress(QLatin1String("glVertexAttrib2fv"));
+    if (!funcs->vertexAttrib2fv) {
+        funcs->vertexAttrib2fv = (type_glVertexAttrib2fv)
+            context->getProcAddress(QLatin1String("glVertexAttrib2fvARB"));
+    }
+
+    if (funcs->vertexAttrib2fv)
+        funcs->vertexAttrib2fv(indx, values);
+    else
+        funcs->vertexAttrib2fv = qglfResolveVertexAttrib2fv;
+}
+
+static void qglfResolveVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttrib3f = (type_glVertexAttrib3f)
+        context->getProcAddress(QLatin1String("glVertexAttrib3f"));
+    if (!funcs->vertexAttrib3f) {
+        funcs->vertexAttrib3f = (type_glVertexAttrib3f)
+            context->getProcAddress(QLatin1String("glVertexAttrib3fARB"));
+    }
+
+    if (funcs->vertexAttrib3f)
+        funcs->vertexAttrib3f(indx, x, y, z);
+    else
+        funcs->vertexAttrib3f = qglfResolveVertexAttrib3f;
+}
+
+static void qglfResolveVertexAttrib3fv(GLuint indx, const GLfloat* values)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttrib3fv)(GLuint indx, const GLfloat* values);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttrib3fv = (type_glVertexAttrib3fv)
+        context->getProcAddress(QLatin1String("glVertexAttrib3fv"));
+    if (!funcs->vertexAttrib3fv) {
+        funcs->vertexAttrib3fv = (type_glVertexAttrib3fv)
+            context->getProcAddress(QLatin1String("glVertexAttrib3fvARB"));
+    }
+
+    if (funcs->vertexAttrib3fv)
+        funcs->vertexAttrib3fv(indx, values);
+    else
+        funcs->vertexAttrib3fv = qglfResolveVertexAttrib3fv;
+}
+
+static void qglfResolveVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttrib4f = (type_glVertexAttrib4f)
+        context->getProcAddress(QLatin1String("glVertexAttrib4f"));
+    if (!funcs->vertexAttrib4f) {
+        funcs->vertexAttrib4f = (type_glVertexAttrib4f)
+            context->getProcAddress(QLatin1String("glVertexAttrib4fARB"));
+    }
+
+    if (funcs->vertexAttrib4f)
+        funcs->vertexAttrib4f(indx, x, y, z, w);
+    else
+        funcs->vertexAttrib4f = qglfResolveVertexAttrib4f;
+}
+
+static void qglfResolveVertexAttrib4fv(GLuint indx, const GLfloat* values)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttrib4fv)(GLuint indx, const GLfloat* values);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttrib4fv = (type_glVertexAttrib4fv)
+        context->getProcAddress(QLatin1String("glVertexAttrib4fv"));
+    if (!funcs->vertexAttrib4fv) {
+        funcs->vertexAttrib4fv = (type_glVertexAttrib4fv)
+            context->getProcAddress(QLatin1String("glVertexAttrib4fvARB"));
+    }
+
+    if (funcs->vertexAttrib4fv)
+        funcs->vertexAttrib4fv(indx, values);
+    else
+        funcs->vertexAttrib4fv = qglfResolveVertexAttrib4fv;
+}
+
+static void qglfResolveVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
+{
+    typedef void (QGLF_APIENTRYP type_glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
+
+    const QGLContext *context = QGLContext::currentContext();
+    QGLFunctionsPrivate *funcs = qt_gl_functions(context);
+
+    funcs->vertexAttribPointer = (type_glVertexAttribPointer)
+        context->getProcAddress(QLatin1String("glVertexAttribPointer"));
+    if (!funcs->vertexAttribPointer) {
+        funcs->vertexAttribPointer = (type_glVertexAttribPointer)
+            context->getProcAddress(QLatin1String("glVertexAttribPointerARB"));
+    }
+
+    if (funcs->vertexAttribPointer)
+        funcs->vertexAttribPointer(indx, size, type, normalized, stride, ptr);
+    else
+        funcs->vertexAttribPointer = qglfResolveVertexAttribPointer;
+}
+
+#endif // !QT_OPENGL_ES_2
+
+QGLFunctionsPrivate::QGLFunctionsPrivate(const QGLContext *)
+{
+#ifndef QT_OPENGL_ES_2
+    activeTexture = qglfResolveActiveTexture;
+    attachShader = qglfResolveAttachShader;
+    bindAttribLocation = qglfResolveBindAttribLocation;
+    bindBuffer = qglfResolveBindBuffer;
+    bindFramebuffer = qglfResolveBindFramebuffer;
+    bindRenderbuffer = qglfResolveBindRenderbuffer;
+    blendColor = qglfResolveBlendColor;
+    blendEquation = qglfResolveBlendEquation;
+    blendEquationSeparate = qglfResolveBlendEquationSeparate;
+    blendFuncSeparate = qglfResolveBlendFuncSeparate;
+    bufferData = qglfResolveBufferData;
+    bufferSubData = qglfResolveBufferSubData;
+    checkFramebufferStatus = qglfResolveCheckFramebufferStatus;
+    compileShader = qglfResolveCompileShader;
+    compressedTexImage2D = qglfResolveCompressedTexImage2D;
+    compressedTexSubImage2D = qglfResolveCompressedTexSubImage2D;
+    createProgram = qglfResolveCreateProgram;
+    createShader = qglfResolveCreateShader;
+    deleteBuffers = qglfResolveDeleteBuffers;
+    deleteFramebuffers = qglfResolveDeleteFramebuffers;
+    deleteProgram = qglfResolveDeleteProgram;
+    deleteRenderbuffers = qglfResolveDeleteRenderbuffers;
+    deleteShader = qglfResolveDeleteShader;
+    detachShader = qglfResolveDetachShader;
+    disableVertexAttribArray = qglfResolveDisableVertexAttribArray;
+    enableVertexAttribArray = qglfResolveEnableVertexAttribArray;
+    framebufferRenderbuffer = qglfResolveFramebufferRenderbuffer;
+    framebufferTexture2D = qglfResolveFramebufferTexture2D;
+    genBuffers = qglfResolveGenBuffers;
+    generateMipmap = qglfResolveGenerateMipmap;
+    genFramebuffers = qglfResolveGenFramebuffers;
+    genRenderbuffers = qglfResolveGenRenderbuffers;
+    getActiveAttrib = qglfResolveGetActiveAttrib;
+    getActiveUniform = qglfResolveGetActiveUniform;
+    getAttachedShaders = qglfResolveGetAttachedShaders;
+    getAttribLocation = qglfResolveGetAttribLocation;
+    getBufferParameteriv = qglfResolveGetBufferParameteriv;
+    getFramebufferAttachmentParameteriv = qglfResolveGetFramebufferAttachmentParameteriv;
+    getProgramiv = qglfResolveGetProgramiv;
+    getProgramInfoLog = qglfResolveGetProgramInfoLog;
+    getRenderbufferParameteriv = qglfResolveGetRenderbufferParameteriv;
+    getShaderiv = qglfResolveGetShaderiv;
+    getShaderInfoLog = qglfResolveGetShaderInfoLog;
+    getShaderPrecisionFormat = qglfResolveGetShaderPrecisionFormat;
+    getShaderSource = qglfResolveGetShaderSource;
+    getUniformfv = qglfResolveGetUniformfv;
+    getUniformiv = qglfResolveGetUniformiv;
+    getUniformLocation = qglfResolveGetUniformLocation;
+    getVertexAttribfv = qglfResolveGetVertexAttribfv;
+    getVertexAttribiv = qglfResolveGetVertexAttribiv;
+    getVertexAttribPointerv = qglfResolveGetVertexAttribPointerv;
+    isBuffer = qglfResolveIsBuffer;
+    isFramebuffer = qglfResolveIsFramebuffer;
+    isProgram = qglfResolveIsProgram;
+    isRenderbuffer = qglfResolveIsRenderbuffer;
+    isShader = qglfResolveIsShader;
+    linkProgram = qglfResolveLinkProgram;
+    releaseShaderCompiler = qglfResolveReleaseShaderCompiler;
+    renderbufferStorage = qglfResolveRenderbufferStorage;
+    sampleCoverage = qglfResolveSampleCoverage;
+    shaderBinary = qglfResolveShaderBinary;
+    shaderSource = qglfResolveShaderSource;
+    stencilFuncSeparate = qglfResolveStencilFuncSeparate;
+    stencilMaskSeparate = qglfResolveStencilMaskSeparate;
+    stencilOpSeparate = qglfResolveStencilOpSeparate;
+    uniform1f = qglfResolveUniform1f;
+    uniform1fv = qglfResolveUniform1fv;
+    uniform1i = qglfResolveUniform1i;
+    uniform1iv = qglfResolveUniform1iv;
+    uniform2f = qglfResolveUniform2f;
+    uniform2fv = qglfResolveUniform2fv;
+    uniform2i = qglfResolveUniform2i;
+    uniform2iv = qglfResolveUniform2iv;
+    uniform3f = qglfResolveUniform3f;
+    uniform3fv = qglfResolveUniform3fv;
+    uniform3i = qglfResolveUniform3i;
+    uniform3iv = qglfResolveUniform3iv;
+    uniform4f = qglfResolveUniform4f;
+    uniform4fv = qglfResolveUniform4fv;
+    uniform4i = qglfResolveUniform4i;
+    uniform4iv = qglfResolveUniform4iv;
+    uniformMatrix2fv = qglfResolveUniformMatrix2fv;
+    uniformMatrix3fv = qglfResolveUniformMatrix3fv;
+    uniformMatrix4fv = qglfResolveUniformMatrix4fv;
+    useProgram = qglfResolveUseProgram;
+    validateProgram = qglfResolveValidateProgram;
+    vertexAttrib1f = qglfResolveVertexAttrib1f;
+    vertexAttrib1fv = qglfResolveVertexAttrib1fv;
+    vertexAttrib2f = qglfResolveVertexAttrib2f;
+    vertexAttrib2fv = qglfResolveVertexAttrib2fv;
+    vertexAttrib3f = qglfResolveVertexAttrib3f;
+    vertexAttrib3fv = qglfResolveVertexAttrib3fv;
+    vertexAttrib4f = qglfResolveVertexAttrib4f;
+    vertexAttrib4fv = qglfResolveVertexAttrib4fv;
+    vertexAttribPointer = qglfResolveVertexAttribPointer;
+#endif // !QT_OPENGL_ES_2
+}
+
+QT_END_NAMESPACE
diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h
new file mode 100644
index 0000000..e06de7f
--- /dev/null
+++ b/src/opengl/qglfunctions.h
@@ -0,0 +1,2290 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGLFUNCTIONS_H
+#define QGLFUNCTIONS_H
+
+#include <QtOpenGL/qgl.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(OpenGL)
+
+// Types that aren't defined in all system's gl.h files.
+typedef ptrdiff_t qgl_GLintptr;
+typedef ptrdiff_t qgl_GLsizeiptr;
+
+#ifndef Q_WS_MAC
+# ifndef QGLF_APIENTRYP
+#   ifdef QGLF_APIENTRY
+#     define QGLF_APIENTRYP QGLF_APIENTRY *
+#   else
+#     define QGLF_APIENTRY
+#     define QGLF_APIENTRYP *
+#   endif
+# endif
+#else
+# define QGLF_APIENTRY
+# define QGLF_APIENTRYP *
+#endif
+
+struct QGLFunctionsPrivate;
+
+// Undefine any macros from GLEW, qglextensions_p.h, etc that
+// may interfere with the definition of QGLFunctions.
+#undef glActiveTexture
+#undef glAttachShader
+#undef glBindAttribLocation
+#undef glBindBuffer
+#undef glBindFramebuffer
+#undef glBindRenderbuffer
+#undef glBlendColor
+#undef glBlendEquation
+#undef glBlendEquationSeparate
+#undef glBlendFuncSeparate
+#undef glBufferData
+#undef glBufferSubData
+#undef glCheckFramebufferStatus
+#undef glClearDepthf
+#undef glCompileShader
+#undef glCompressedTexImage2D
+#undef glCompressedTexSubImage2D
+#undef glCreateProgram
+#undef glCreateShader
+#undef glDeleteBuffers
+#undef glDeleteFramebuffers
+#undef glDeleteProgram
+#undef glDeleteRenderbuffers
+#undef glDeleteShader
+#undef glDepthRangef
+#undef glDetachShader
+#undef glDisableVertexAttribArray
+#undef glEnableVertexAttribArray
+#undef glFramebufferRenderbuffer
+#undef glFramebufferTexture2D
+#undef glGenBuffers
+#undef glGenerateMipmap
+#undef glGenFramebuffers
+#undef glGenRenderbuffers
+#undef glGetActiveAttrib
+#undef glGetActiveUniform
+#undef glGetAttachedShaders
+#undef glGetAttribLocation
+#undef glGetBufferParameteriv
+#undef glGetFramebufferAttachmentParameteriv
+#undef glGetProgramiv
+#undef glGetProgramInfoLog
+#undef glGetRenderbufferParameteriv
+#undef glGetShaderiv
+#undef glGetShaderInfoLog
+#undef glGetShaderPrecisionFormat
+#undef glGetShaderSource
+#undef glGetUniformfv
+#undef glGetUniformiv
+#undef glGetUniformLocation
+#undef glGetVertexAttribfv
+#undef glGetVertexAttribiv
+#undef glGetVertexAttribPointerv
+#undef glIsBuffer
+#undef glIsFramebuffer
+#undef glIsProgram
+#undef glIsRenderbuffer
+#undef glIsShader
+#undef glLinkProgram
+#undef glReleaseShaderCompiler
+#undef glRenderbufferStorage
+#undef glSampleCoverage
+#undef glShaderBinary
+#undef glShaderSource
+#undef glStencilFuncSeparate
+#undef glStencilMaskSeparate
+#undef glStencilOpSeparate
+#undef glUniform1f
+#undef glUniform1fv
+#undef glUniform1i
+#undef glUniform1iv
+#undef glUniform2f
+#undef glUniform2fv
+#undef glUniform2i
+#undef glUniform2iv
+#undef glUniform3f
+#undef glUniform3fv
+#undef glUniform3i
+#undef glUniform3iv
+#undef glUniform4f
+#undef glUniform4fv
+#undef glUniform4i
+#undef glUniform4iv
+#undef glUniformMatrix2fv
+#undef glUniformMatrix3fv
+#undef glUniformMatrix4fv
+#undef glUseProgram
+#undef glValidateProgram
+#undef glVertexAttrib1f
+#undef glVertexAttrib1fv
+#undef glVertexAttrib2f
+#undef glVertexAttrib2fv
+#undef glVertexAttrib3f
+#undef glVertexAttrib3fv
+#undef glVertexAttrib4f
+#undef glVertexAttrib4fv
+#undef glVertexAttribPointer
+
+class Q_OPENGL_EXPORT QGLFunctions
+{
+public:
+    QGLFunctions();
+    explicit QGLFunctions(const QGLContext *context);
+    ~QGLFunctions() {}
+
+    enum OpenGLFeature
+    {
+        Multitexture          = 0x0001,
+        Shaders               = 0x0002,
+        Buffers               = 0x0004,
+        Framebuffers          = 0x0008,
+        BlendColor            = 0x0010,
+        BlendEquation         = 0x0020,
+        BlendEquationSeparate = 0x0040,
+        BlendFuncSeparate     = 0x0080,
+        BlendSubtract         = 0x0100,
+        CompressedTextures    = 0x0200,
+        Multisample           = 0x0400,
+        StencilSeparate       = 0x0800,
+        NPOTTextures          = 0x1000
+    };
+    Q_DECLARE_FLAGS(OpenGLFeatures, OpenGLFeature)
+
+    QGLFunctions::OpenGLFeatures openGLFeatures() const;
+    bool hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const;
+
+    void initializeGLFunctions(const QGLContext *context = 0);
+
+    void glActiveTexture(GLenum texture);
+    void glAttachShader(GLuint program, GLuint shader);
+    void glBindAttribLocation(GLuint program, GLuint index, const char* name);
+    void glBindBuffer(GLenum target, GLuint buffer);
+    void glBindFramebuffer(GLenum target, GLuint framebuffer);
+    void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
+    void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+    void glBlendEquation(GLenum mode);
+    void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
+    void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+    void glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage);
+    void glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data);
+    GLenum glCheckFramebufferStatus(GLenum target);
+    void glClearDepthf(GLclampf depth);
+    void glCompileShader(GLuint shader);
+    void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
+    void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
+    GLuint glCreateProgram();
+    GLuint glCreateShader(GLenum type);
+    void glDeleteBuffers(GLsizei n, const GLuint* buffers);
+    void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
+    void glDeleteProgram(GLuint program);
+    void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
+    void glDeleteShader(GLuint shader);
+    void glDepthRangef(GLclampf zNear, GLclampf zFar);
+    void glDetachShader(GLuint program, GLuint shader);
+    void glDisableVertexAttribArray(GLuint index);
+    void glEnableVertexAttribArray(GLuint index);
+    void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+    void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+    void glGenBuffers(GLsizei n, GLuint* buffers);
+    void glGenerateMipmap(GLenum target);
+    void glGenFramebuffers(GLsizei n, GLuint* framebuffers);
+    void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers);
+    void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+    void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+    void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+    int glGetAttribLocation(GLuint program, const char* name);
+    void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
+    void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
+    void glGetProgramiv(GLuint program, GLenum pname, GLint* params);
+    void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
+    void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
+    void glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
+    void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
+    void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+    void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
+    void glGetUniformfv(GLuint program, GLint location, GLfloat* params);
+    void glGetUniformiv(GLuint program, GLint location, GLint* params);
+    int glGetUniformLocation(GLuint program, const char* name);
+    void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
+    void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
+    void glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer);
+    GLboolean glIsBuffer(GLuint buffer);
+    GLboolean glIsFramebuffer(GLuint framebuffer);
+    GLboolean glIsProgram(GLuint program);
+    GLboolean glIsRenderbuffer(GLuint renderbuffer);
+    GLboolean glIsShader(GLuint shader);
+    void glLinkProgram(GLuint program);
+    void glReleaseShaderCompiler();
+    void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+    void glSampleCoverage(GLclampf value, GLboolean invert);
+    void glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
+    void glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length);
+    void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
+    void glStencilMaskSeparate(GLenum face, GLuint mask);
+    void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+    void glUniform1f(GLint location, GLfloat x);
+    void glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
+    void glUniform1i(GLint location, GLint x);
+    void glUniform1iv(GLint location, GLsizei count, const GLint* v);
+    void glUniform2f(GLint location, GLfloat x, GLfloat y);
+    void glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
+    void glUniform2i(GLint location, GLint x, GLint y);
+    void glUniform2iv(GLint location, GLsizei count, const GLint* v);
+    void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
+    void glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
+    void glUniform3i(GLint location, GLint x, GLint y, GLint z);
+    void glUniform3iv(GLint location, GLsizei count, const GLint* v);
+    void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+    void glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
+    void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
+    void glUniform4iv(GLint location, GLsizei count, const GLint* v);
+    void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+    void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+    void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+    void glUseProgram(GLuint program);
+    void glValidateProgram(GLuint program);
+    void glVertexAttrib1f(GLuint indx, GLfloat x);
+    void glVertexAttrib1fv(GLuint indx, const GLfloat* values);
+    void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
+    void glVertexAttrib2fv(GLuint indx, const GLfloat* values);
+    void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+    void glVertexAttrib3fv(GLuint indx, const GLfloat* values);
+    void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+    void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
+    void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
+
+private:
+    QGLFunctionsPrivate *d_ptr;
+    static bool isInitialized(const QGLFunctionsPrivate *d) { return d != 0; }
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFunctions::OpenGLFeatures)
+
+struct QGLFunctionsPrivate
+{
+    QGLFunctionsPrivate(const QGLContext *context = 0);
+
+#ifndef QT_OPENGL_ES_2
+    void (QGLF_APIENTRYP activeTexture)(GLenum texture);
+    void (QGLF_APIENTRYP attachShader)(GLuint program, GLuint shader);
+    void (QGLF_APIENTRYP bindAttribLocation)(GLuint program, GLuint index, const char* name);
+    void (QGLF_APIENTRYP bindBuffer)(GLenum target, GLuint buffer);
+    void (QGLF_APIENTRYP bindFramebuffer)(GLenum target, GLuint framebuffer);
+    void (QGLF_APIENTRYP bindRenderbuffer)(GLenum target, GLuint renderbuffer);
+    void (QGLF_APIENTRYP blendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+    void (QGLF_APIENTRYP blendEquation)(GLenum mode);
+    void (QGLF_APIENTRYP blendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
+    void (QGLF_APIENTRYP blendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+    void (QGLF_APIENTRYP bufferData)(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage);
+    void (QGLF_APIENTRYP bufferSubData)(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data);
+    GLenum (QGLF_APIENTRYP checkFramebufferStatus)(GLenum target);
+    void (QGLF_APIENTRYP compileShader)(GLuint shader);
+    void (QGLF_APIENTRYP compressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
+    void (QGLF_APIENTRYP compressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
+    GLuint (QGLF_APIENTRYP createProgram)();
+    GLuint (QGLF_APIENTRYP createShader)(GLenum type);
+    void (QGLF_APIENTRYP deleteBuffers)(GLsizei n, const GLuint* buffers);
+    void (QGLF_APIENTRYP deleteFramebuffers)(GLsizei n, const GLuint* framebuffers);
+    void (QGLF_APIENTRYP deleteProgram)(GLuint program);
+    void (QGLF_APIENTRYP deleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers);
+    void (QGLF_APIENTRYP deleteShader)(GLuint shader);
+    void (QGLF_APIENTRYP detachShader)(GLuint program, GLuint shader);
+    void (QGLF_APIENTRYP disableVertexAttribArray)(GLuint index);
+    void (QGLF_APIENTRYP enableVertexAttribArray)(GLuint index);
+    void (QGLF_APIENTRYP framebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+    void (QGLF_APIENTRYP framebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+    void (QGLF_APIENTRYP genBuffers)(GLsizei n, GLuint* buffers);
+    void (QGLF_APIENTRYP generateMipmap)(GLenum target);
+    void (QGLF_APIENTRYP genFramebuffers)(GLsizei n, GLuint* framebuffers);
+    void (QGLF_APIENTRYP genRenderbuffers)(GLsizei n, GLuint* renderbuffers);
+    void (QGLF_APIENTRYP getActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+    void (QGLF_APIENTRYP getActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+    void (QGLF_APIENTRYP getAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+    int (QGLF_APIENTRYP getAttribLocation)(GLuint program, const char* name);
+    void (QGLF_APIENTRYP getBufferParameteriv)(GLenum target, GLenum pname, GLint* params);
+    void (QGLF_APIENTRYP getFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params);
+    void (QGLF_APIENTRYP getProgramiv)(GLuint program, GLenum pname, GLint* params);
+    void (QGLF_APIENTRYP getProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
+    void (QGLF_APIENTRYP getRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params);
+    void (QGLF_APIENTRYP getShaderiv)(GLuint shader, GLenum pname, GLint* params);
+    void (QGLF_APIENTRYP getShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
+    void (QGLF_APIENTRYP getShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+    void (QGLF_APIENTRYP getShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
+    void (QGLF_APIENTRYP getUniformfv)(GLuint program, GLint location, GLfloat* params);
+    void (QGLF_APIENTRYP getUniformiv)(GLuint program, GLint location, GLint* params);
+    int (QGLF_APIENTRYP getUniformLocation)(GLuint program, const char* name);
+    void (QGLF_APIENTRYP getVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params);
+    void (QGLF_APIENTRYP getVertexAttribiv)(GLuint index, GLenum pname, GLint* params);
+    void (QGLF_APIENTRYP getVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer);
+    GLboolean (QGLF_APIENTRYP isBuffer)(GLuint buffer);
+    GLboolean (QGLF_APIENTRYP isFramebuffer)(GLuint framebuffer);
+    GLboolean (QGLF_APIENTRYP isProgram)(GLuint program);
+    GLboolean (QGLF_APIENTRYP isRenderbuffer)(GLuint renderbuffer);
+    GLboolean (QGLF_APIENTRYP isShader)(GLuint shader);
+    void (QGLF_APIENTRYP linkProgram)(GLuint program);
+    void (QGLF_APIENTRYP releaseShaderCompiler)();
+    void (QGLF_APIENTRYP renderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+    void (QGLF_APIENTRYP sampleCoverage)(GLclampf value, GLboolean invert);
+    void (QGLF_APIENTRYP shaderBinary)(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
+    void (QGLF_APIENTRYP shaderSource)(GLuint shader, GLsizei count, const char** string, const GLint* length);
+    void (QGLF_APIENTRYP stencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);
+    void (QGLF_APIENTRYP stencilMaskSeparate)(GLenum face, GLuint mask);
+    void (QGLF_APIENTRYP stencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+    void (QGLF_APIENTRYP uniform1f)(GLint location, GLfloat x);
+    void (QGLF_APIENTRYP uniform1fv)(GLint location, GLsizei count, const GLfloat* v);
+    void (QGLF_APIENTRYP uniform1i)(GLint location, GLint x);
+    void (QGLF_APIENTRYP uniform1iv)(GLint location, GLsizei count, const GLint* v);
+    void (QGLF_APIENTRYP uniform2f)(GLint location, GLfloat x, GLfloat y);
+    void (QGLF_APIENTRYP uniform2fv)(GLint location, GLsizei count, const GLfloat* v);
+    void (QGLF_APIENTRYP uniform2i)(GLint location, GLint x, GLint y);
+    void (QGLF_APIENTRYP uniform2iv)(GLint location, GLsizei count, const GLint* v);
+    void (QGLF_APIENTRYP uniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z);
+    void (QGLF_APIENTRYP uniform3fv)(GLint location, GLsizei count, const GLfloat* v);
+    void (QGLF_APIENTRYP uniform3i)(GLint location, GLint x, GLint y, GLint z);
+    void (QGLF_APIENTRYP uniform3iv)(GLint location, GLsizei count, const GLint* v);
+    void (QGLF_APIENTRYP uniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+    void (QGLF_APIENTRYP uniform4fv)(GLint location, GLsizei count, const GLfloat* v);
+    void (QGLF_APIENTRYP uniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w);
+    void (QGLF_APIENTRYP uniform4iv)(GLint location, GLsizei count, const GLint* v);
+    void (QGLF_APIENTRYP uniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+    void (QGLF_APIENTRYP uniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+    void (QGLF_APIENTRYP uniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+    void (QGLF_APIENTRYP useProgram)(GLuint program);
+    void (QGLF_APIENTRYP validateProgram)(GLuint program);
+    void (QGLF_APIENTRYP vertexAttrib1f)(GLuint indx, GLfloat x);
+    void (QGLF_APIENTRYP vertexAttrib1fv)(GLuint indx, const GLfloat* values);
+    void (QGLF_APIENTRYP vertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y);
+    void (QGLF_APIENTRYP vertexAttrib2fv)(GLuint indx, const GLfloat* values);
+    void (QGLF_APIENTRYP vertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+    void (QGLF_APIENTRYP vertexAttrib3fv)(GLuint indx, const GLfloat* values);
+    void (QGLF_APIENTRYP vertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+    void (QGLF_APIENTRYP vertexAttrib4fv)(GLuint indx, const GLfloat* values);
+    void (QGLF_APIENTRYP vertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
+#endif
+};
+
+inline void QGLFunctions::glActiveTexture(GLenum texture)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glActiveTexture(texture);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->activeTexture(texture);
+#endif
+}
+
+inline void QGLFunctions::glAttachShader(GLuint program, GLuint shader)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glAttachShader(program, shader);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->attachShader(program, shader);
+#endif
+}
+
+inline void QGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glBindAttribLocation(program, index, name);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->bindAttribLocation(program, index, name);
+#endif
+}
+
+inline void QGLFunctions::glBindBuffer(GLenum target, GLuint buffer)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glBindBuffer(target, buffer);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->bindBuffer(target, buffer);
+#endif
+}
+
+inline void QGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glBindFramebuffer(target, framebuffer);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->bindFramebuffer(target, framebuffer);
+#endif
+}
+
+inline void QGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glBindRenderbuffer(target, renderbuffer);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->bindRenderbuffer(target, renderbuffer);
+#endif
+}
+
+inline void QGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glBlendColor(red, green, blue, alpha);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->blendColor(red, green, blue, alpha);
+#endif
+}
+
+inline void QGLFunctions::glBlendEquation(GLenum mode)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glBlendEquation(mode);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->blendEquation(mode);
+#endif
+}
+
+inline void QGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glBlendEquationSeparate(modeRGB, modeAlpha);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->blendEquationSeparate(modeRGB, modeAlpha);
+#endif
+}
+
+inline void QGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+#endif
+}
+
+inline void QGLFunctions::glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glBufferData(target, size, data, usage);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->bufferData(target, size, data, usage);
+#endif
+}
+
+inline void QGLFunctions::glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glBufferSubData(target, offset, size, data);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->bufferSubData(target, offset, size, data);
+#endif
+}
+
+inline GLenum QGLFunctions::glCheckFramebufferStatus(GLenum target)
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glCheckFramebufferStatus(target);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->checkFramebufferStatus(target);
+#endif
+}
+
+inline void QGLFunctions::glClearDepthf(GLclampf depth)
+{
+#ifndef QT_OPENGL_ES
+    ::glClearDepth(depth);
+#else
+    ::glClearDepthf(depth);
+#endif
+}
+
+inline void QGLFunctions::glCompileShader(GLuint shader)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glCompileShader(shader);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->compileShader(shader);
+#endif
+}
+
+inline void QGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+#endif
+}
+
+inline void QGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+#endif
+}
+
+inline GLuint QGLFunctions::glCreateProgram()
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glCreateProgram();
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->createProgram();
+#endif
+}
+
+inline GLuint QGLFunctions::glCreateShader(GLenum type)
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glCreateShader(type);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->createShader(type);
+#endif
+}
+
+inline void QGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glDeleteBuffers(n, buffers);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->deleteBuffers(n, buffers);
+#endif
+}
+
+inline void QGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glDeleteFramebuffers(n, framebuffers);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->deleteFramebuffers(n, framebuffers);
+#endif
+}
+
+inline void QGLFunctions::glDeleteProgram(GLuint program)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glDeleteProgram(program);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->deleteProgram(program);
+#endif
+}
+
+inline void QGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glDeleteRenderbuffers(n, renderbuffers);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->deleteRenderbuffers(n, renderbuffers);
+#endif
+}
+
+inline void QGLFunctions::glDeleteShader(GLuint shader)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glDeleteShader(shader);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->deleteShader(shader);
+#endif
+}
+
+inline void QGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+#ifndef QT_OPENGL_ES
+    ::glDepthRange(zNear, zFar);
+#else
+    ::glDepthRangef(zNear, zFar);
+#endif
+}
+
+inline void QGLFunctions::glDetachShader(GLuint program, GLuint shader)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glDetachShader(program, shader);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->detachShader(program, shader);
+#endif
+}
+
+inline void QGLFunctions::glDisableVertexAttribArray(GLuint index)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glDisableVertexAttribArray(index);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->disableVertexAttribArray(index);
+#endif
+}
+
+inline void QGLFunctions::glEnableVertexAttribArray(GLuint index)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glEnableVertexAttribArray(index);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->enableVertexAttribArray(index);
+#endif
+}
+
+inline void QGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+#endif
+}
+
+inline void QGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glFramebufferTexture2D(target, attachment, textarget, texture, level);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->framebufferTexture2D(target, attachment, textarget, texture, level);
+#endif
+}
+
+inline void QGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glGenBuffers(n, buffers);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->genBuffers(n, buffers);
+#endif
+}
+
+inline void QGLFunctions::glGenerateMipmap(GLenum target)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGenerateMipmap(target);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->generateMipmap(target);
+#endif
+}
+
+inline void QGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGenFramebuffers(n, framebuffers);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->genFramebuffers(n, framebuffers);
+#endif
+}
+
+inline void QGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGenRenderbuffers(n, renderbuffers);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->genRenderbuffers(n, renderbuffers);
+#endif
+}
+
+inline void QGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetActiveAttrib(program, index, bufsize, length, size, type, name);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getActiveAttrib(program, index, bufsize, length, size, type, name);
+#endif
+}
+
+inline void QGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetActiveUniform(program, index, bufsize, length, size, type, name);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getActiveUniform(program, index, bufsize, length, size, type, name);
+#endif
+}
+
+inline void QGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetAttachedShaders(program, maxcount, count, shaders);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getAttachedShaders(program, maxcount, count, shaders);
+#endif
+}
+
+inline int QGLFunctions::glGetAttribLocation(GLuint program, const char* name)
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glGetAttribLocation(program, name);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->getAttribLocation(program, name);
+#endif
+}
+
+inline void QGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetBufferParameteriv(target, pname, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getBufferParameteriv(target, pname, params);
+#endif
+}
+
+inline void QGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
+#endif
+}
+
+inline void QGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetProgramiv(program, pname, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getProgramiv(program, pname, params);
+#endif
+}
+
+inline void QGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetProgramInfoLog(program, bufsize, length, infolog);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getProgramInfoLog(program, bufsize, length, infolog);
+#endif
+}
+
+inline void QGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetRenderbufferParameteriv(target, pname, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getRenderbufferParameteriv(target, pname, params);
+#endif
+}
+
+inline void QGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetShaderiv(shader, pname, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getShaderiv(shader, pname, params);
+#endif
+}
+
+inline void QGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetShaderInfoLog(shader, bufsize, length, infolog);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getShaderInfoLog(shader, bufsize, length, infolog);
+#endif
+}
+
+inline void QGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+#endif
+}
+
+inline void QGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetShaderSource(shader, bufsize, length, source);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getShaderSource(shader, bufsize, length, source);
+#endif
+}
+
+inline void QGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetUniformfv(program, location, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getUniformfv(program, location, params);
+#endif
+}
+
+inline void QGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetUniformiv(program, location, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getUniformiv(program, location, params);
+#endif
+}
+
+inline int QGLFunctions::glGetUniformLocation(GLuint program, const char* name)
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glGetUniformLocation(program, name);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->getUniformLocation(program, name);
+#endif
+}
+
+inline void QGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetVertexAttribfv(index, pname, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getVertexAttribfv(index, pname, params);
+#endif
+}
+
+inline void QGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetVertexAttribiv(index, pname, params);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getVertexAttribiv(index, pname, params);
+#endif
+}
+
+inline void QGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glGetVertexAttribPointerv(index, pname, pointer);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->getVertexAttribPointerv(index, pname, pointer);
+#endif
+}
+
+inline GLboolean QGLFunctions::glIsBuffer(GLuint buffer)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    return ::glIsBuffer(buffer);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->isBuffer(buffer);
+#endif
+}
+
+inline GLboolean QGLFunctions::glIsFramebuffer(GLuint framebuffer)
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glIsFramebuffer(framebuffer);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->isFramebuffer(framebuffer);
+#endif
+}
+
+inline GLboolean QGLFunctions::glIsProgram(GLuint program)
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glIsProgram(program);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->isProgram(program);
+#endif
+}
+
+inline GLboolean QGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glIsRenderbuffer(renderbuffer);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->isRenderbuffer(renderbuffer);
+#endif
+}
+
+inline GLboolean QGLFunctions::glIsShader(GLuint shader)
+{
+#if defined(QT_OPENGL_ES_2)
+    return ::glIsShader(shader);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    return d_ptr->isShader(shader);
+#endif
+}
+
+inline void QGLFunctions::glLinkProgram(GLuint program)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glLinkProgram(program);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->linkProgram(program);
+#endif
+}
+
+inline void QGLFunctions::glReleaseShaderCompiler()
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glReleaseShaderCompiler();
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->releaseShaderCompiler();
+#endif
+}
+
+inline void QGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glRenderbufferStorage(target, internalformat, width, height);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->renderbufferStorage(target, internalformat, width, height);
+#endif
+}
+
+inline void QGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
+{
+#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2)
+    ::glSampleCoverage(value, invert);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->sampleCoverage(value, invert);
+#endif
+}
+
+inline void QGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glShaderBinary(n, shaders, binaryformat, binary, length);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->shaderBinary(n, shaders, binaryformat, binary, length);
+#endif
+}
+
+inline void QGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glShaderSource(shader, count, string, length);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->shaderSource(shader, count, string, length);
+#endif
+}
+
+inline void QGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glStencilFuncSeparate(face, func, ref, mask);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->stencilFuncSeparate(face, func, ref, mask);
+#endif
+}
+
+inline void QGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glStencilMaskSeparate(face, mask);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->stencilMaskSeparate(face, mask);
+#endif
+}
+
+inline void QGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glStencilOpSeparate(face, fail, zfail, zpass);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->stencilOpSeparate(face, fail, zfail, zpass);
+#endif
+}
+
+inline void QGLFunctions::glUniform1f(GLint location, GLfloat x)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform1f(location, x);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform1f(location, x);
+#endif
+}
+
+inline void QGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform1fv(location, count, v);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform1fv(location, count, v);
+#endif
+}
+
+inline void QGLFunctions::glUniform1i(GLint location, GLint x)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform1i(location, x);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform1i(location, x);
+#endif
+}
+
+inline void QGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform1iv(location, count, v);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform1iv(location, count, v);
+#endif
+}
+
+inline void QGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform2f(location, x, y);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform2f(location, x, y);
+#endif
+}
+
+inline void QGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform2fv(location, count, v);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform2fv(location, count, v);
+#endif
+}
+
+inline void QGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform2i(location, x, y);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform2i(location, x, y);
+#endif
+}
+
+inline void QGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform2iv(location, count, v);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform2iv(location, count, v);
+#endif
+}
+
+inline void QGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform3f(location, x, y, z);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform3f(location, x, y, z);
+#endif
+}
+
+inline void QGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform3fv(location, count, v);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform3fv(location, count, v);
+#endif
+}
+
+inline void QGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform3i(location, x, y, z);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform3i(location, x, y, z);
+#endif
+}
+
+inline void QGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform3iv(location, count, v);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform3iv(location, count, v);
+#endif
+}
+
+inline void QGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform4f(location, x, y, z, w);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform4f(location, x, y, z, w);
+#endif
+}
+
+inline void QGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform4fv(location, count, v);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform4fv(location, count, v);
+#endif
+}
+
+inline void QGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform4i(location, x, y, z, w);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform4i(location, x, y, z, w);
+#endif
+}
+
+inline void QGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniform4iv(location, count, v);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniform4iv(location, count, v);
+#endif
+}
+
+inline void QGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniformMatrix2fv(location, count, transpose, value);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniformMatrix2fv(location, count, transpose, value);
+#endif
+}
+
+inline void QGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniformMatrix3fv(location, count, transpose, value);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniformMatrix3fv(location, count, transpose, value);
+#endif
+}
+
+inline void QGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUniformMatrix4fv(location, count, transpose, value);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->uniformMatrix4fv(location, count, transpose, value);
+#endif
+}
+
+inline void QGLFunctions::glUseProgram(GLuint program)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glUseProgram(program);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->useProgram(program);
+#endif
+}
+
+inline void QGLFunctions::glValidateProgram(GLuint program)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glValidateProgram(program);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->validateProgram(program);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttrib1f(indx, x);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttrib1f(indx, x);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttrib1fv(indx, values);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttrib1fv(indx, values);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttrib2f(indx, x, y);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttrib2f(indx, x, y);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttrib2fv(indx, values);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttrib2fv(indx, values);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttrib3f(indx, x, y, z);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttrib3f(indx, x, y, z);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttrib3fv(indx, values);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttrib3fv(indx, values);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttrib4f(indx, x, y, z, w);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttrib4f(indx, x, y, z, w);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttrib4fv(indx, values);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttrib4fv(indx, values);
+#endif
+}
+
+inline void QGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
+{
+#if defined(QT_OPENGL_ES_2)
+    ::glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
+#else
+    Q_ASSERT(QGLFunctions::isInitialized(d_ptr));
+    d_ptr->vertexAttribPointer(indx, size, type, normalized, stride, ptr);
+#endif
+}
+
+#ifndef GL_ACTIVE_ATTRIBUTE_MAX_LENGTH
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#endif
+#ifndef GL_ACTIVE_ATTRIBUTES
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#endif
+#ifndef GL_ACTIVE_TEXTURE
+#define GL_ACTIVE_TEXTURE 0x84E0
+#endif
+#ifndef GL_ACTIVE_UNIFORM_MAX_LENGTH
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#endif
+#ifndef GL_ACTIVE_UNIFORMS
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#endif
+#ifndef GL_ALIASED_LINE_WIDTH_RANGE
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#endif
+#ifndef GL_ALIASED_POINT_SIZE_RANGE
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#endif
+#ifndef GL_ALPHA
+#define GL_ALPHA 0x1906
+#endif
+#ifndef GL_ALPHA_BITS
+#define GL_ALPHA_BITS 0x0D55
+#endif
+#ifndef GL_ALWAYS
+#define GL_ALWAYS 0x0207
+#endif
+#ifndef GL_ARRAY_BUFFER
+#define GL_ARRAY_BUFFER 0x8892
+#endif
+#ifndef GL_ARRAY_BUFFER_BINDING
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#endif
+#ifndef GL_ATTACHED_SHADERS
+#define GL_ATTACHED_SHADERS 0x8B85
+#endif
+#ifndef GL_BACK
+#define GL_BACK 0x0405
+#endif
+#ifndef GL_BLEND
+#define GL_BLEND 0x0BE2
+#endif
+#ifndef GL_BLEND_COLOR
+#define GL_BLEND_COLOR 0x8005
+#endif
+#ifndef GL_BLEND_DST_ALPHA
+#define GL_BLEND_DST_ALPHA 0x80CA
+#endif
+#ifndef GL_BLEND_DST_RGB
+#define GL_BLEND_DST_RGB 0x80C8
+#endif
+#ifndef GL_BLEND_EQUATION
+#define GL_BLEND_EQUATION 0x8009
+#endif
+#ifndef GL_BLEND_EQUATION_ALPHA
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#endif
+#ifndef GL_BLEND_EQUATION_RGB
+#define GL_BLEND_EQUATION_RGB 0x8009
+#endif
+#ifndef GL_BLEND_SRC_ALPHA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#endif
+#ifndef GL_BLEND_SRC_RGB
+#define GL_BLEND_SRC_RGB 0x80C9
+#endif
+#ifndef GL_BLUE_BITS
+#define GL_BLUE_BITS 0x0D54
+#endif
+#ifndef GL_BOOL
+#define GL_BOOL 0x8B56
+#endif
+#ifndef GL_BOOL_VEC2
+#define GL_BOOL_VEC2 0x8B57
+#endif
+#ifndef GL_BOOL_VEC3
+#define GL_BOOL_VEC3 0x8B58
+#endif
+#ifndef GL_BOOL_VEC4
+#define GL_BOOL_VEC4 0x8B59
+#endif
+#ifndef GL_BUFFER_SIZE
+#define GL_BUFFER_SIZE 0x8764
+#endif
+#ifndef GL_BUFFER_USAGE
+#define GL_BUFFER_USAGE 0x8765
+#endif
+#ifndef GL_BYTE
+#define GL_BYTE 0x1400
+#endif
+#ifndef GL_CCW
+#define GL_CCW 0x0901
+#endif
+#ifndef GL_CLAMP_TO_EDGE
+#define GL_CLAMP_TO_EDGE 0x812F
+#endif
+#ifndef GL_COLOR_ATTACHMENT0
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#endif
+#ifndef GL_COLOR_BUFFER_BIT
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#endif
+#ifndef GL_COLOR_CLEAR_VALUE
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#endif
+#ifndef GL_COLOR_WRITEMASK
+#define GL_COLOR_WRITEMASK 0x0C23
+#endif
+#ifndef GL_COMPILE_STATUS
+#define GL_COMPILE_STATUS 0x8B81
+#endif
+#ifndef GL_COMPRESSED_TEXTURE_FORMATS
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#endif
+#ifndef GL_CONSTANT_ALPHA
+#define GL_CONSTANT_ALPHA 0x8003
+#endif
+#ifndef GL_CONSTANT_COLOR
+#define GL_CONSTANT_COLOR 0x8001
+#endif
+#ifndef GL_CULL_FACE
+#define GL_CULL_FACE 0x0B44
+#endif
+#ifndef GL_CULL_FACE_MODE
+#define GL_CULL_FACE_MODE 0x0B45
+#endif
+#ifndef GL_CURRENT_PROGRAM
+#define GL_CURRENT_PROGRAM 0x8B8D
+#endif
+#ifndef GL_CURRENT_VERTEX_ATTRIB
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+#endif
+#ifndef GL_CW
+#define GL_CW 0x0900
+#endif
+#ifndef GL_DECR
+#define GL_DECR 0x1E03
+#endif
+#ifndef GL_DECR_WRAP
+#define GL_DECR_WRAP 0x8508
+#endif
+#ifndef GL_DELETE_STATUS
+#define GL_DELETE_STATUS 0x8B80
+#endif
+#ifndef GL_DEPTH_ATTACHMENT
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#endif
+#ifndef GL_DEPTH_BITS
+#define GL_DEPTH_BITS 0x0D56
+#endif
+#ifndef GL_DEPTH_BUFFER_BIT
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#endif
+#ifndef GL_DEPTH_CLEAR_VALUE
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#endif
+#ifndef GL_DEPTH_COMPONENT
+#define GL_DEPTH_COMPONENT 0x1902
+#endif
+#ifndef GL_DEPTH_COMPONENT16
+#define GL_DEPTH_COMPONENT16 0x81A5
+#endif
+#ifndef GL_DEPTH_FUNC
+#define GL_DEPTH_FUNC 0x0B74
+#endif
+#ifndef GL_DEPTH_RANGE
+#define GL_DEPTH_RANGE 0x0B70
+#endif
+#ifndef GL_DEPTH_TEST
+#define GL_DEPTH_TEST 0x0B71
+#endif
+#ifndef GL_DEPTH_WRITEMASK
+#define GL_DEPTH_WRITEMASK 0x0B72
+#endif
+#ifndef GL_DITHER
+#define GL_DITHER 0x0BD0
+#endif
+#ifndef GL_DONT_CARE
+#define GL_DONT_CARE 0x1100
+#endif
+#ifndef GL_DST_ALPHA
+#define GL_DST_ALPHA 0x0304
+#endif
+#ifndef GL_DST_COLOR
+#define GL_DST_COLOR 0x0306
+#endif
+#ifndef GL_DYNAMIC_DRAW
+#define GL_DYNAMIC_DRAW 0x88E8
+#endif
+#ifndef GL_ELEMENT_ARRAY_BUFFER
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#endif
+#ifndef GL_ELEMENT_ARRAY_BUFFER_BINDING
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#endif
+#ifndef GL_EQUAL
+#define GL_EQUAL 0x0202
+#endif
+#ifndef GL_EXTENSIONS
+#define GL_EXTENSIONS 0x1F03
+#endif
+#ifndef GL_FALSE
+#define GL_FALSE 0
+#endif
+#ifndef GL_FASTEST
+#define GL_FASTEST 0x1101
+#endif
+#ifndef GL_FIXED
+#define GL_FIXED 0x140C
+#endif
+#ifndef GL_FLOAT
+#define GL_FLOAT 0x1406
+#endif
+#ifndef GL_FLOAT_MAT2
+#define GL_FLOAT_MAT2 0x8B5A
+#endif
+#ifndef GL_FLOAT_MAT3
+#define GL_FLOAT_MAT3 0x8B5B
+#endif
+#ifndef GL_FLOAT_MAT4
+#define GL_FLOAT_MAT4 0x8B5C
+#endif
+#ifndef GL_FLOAT_VEC2
+#define GL_FLOAT_VEC2 0x8B50
+#endif
+#ifndef GL_FLOAT_VEC3
+#define GL_FLOAT_VEC3 0x8B51
+#endif
+#ifndef GL_FLOAT_VEC4
+#define GL_FLOAT_VEC4 0x8B52
+#endif
+#ifndef GL_FRAGMENT_SHADER
+#define GL_FRAGMENT_SHADER 0x8B30
+#endif
+#ifndef GL_FRAMEBUFFER
+#define GL_FRAMEBUFFER 0x8D40
+#endif
+#ifndef GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#endif
+#ifndef GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#endif
+#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#endif
+#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#endif
+#ifndef GL_FRAMEBUFFER_BINDING
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#endif
+#ifndef GL_FRAMEBUFFER_COMPLETE
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#endif
+#ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#endif
+#ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#endif
+#ifndef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#endif
+#ifndef GL_FRAMEBUFFER_UNSUPPORTED
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#endif
+#ifndef GL_FRONT
+#define GL_FRONT 0x0404
+#endif
+#ifndef GL_FRONT_AND_BACK
+#define GL_FRONT_AND_BACK 0x0408
+#endif
+#ifndef GL_FRONT_FACE
+#define GL_FRONT_FACE 0x0B46
+#endif
+#ifndef GL_FUNC_ADD
+#define GL_FUNC_ADD 0x8006
+#endif
+#ifndef GL_FUNC_REVERSE_SUBTRACT
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#endif
+#ifndef GL_FUNC_SUBTRACT
+#define GL_FUNC_SUBTRACT 0x800A
+#endif
+#ifndef GL_GENERATE_MIPMAP_HINT
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#endif
+#ifndef GL_GEQUAL
+#define GL_GEQUAL 0x0206
+#endif
+#ifndef GL_GREATER
+#define GL_GREATER 0x0204
+#endif
+#ifndef GL_GREEN_BITS
+#define GL_GREEN_BITS 0x0D53
+#endif
+#ifndef GL_HIGH_FLOAT
+#define GL_HIGH_FLOAT 0x8DF2
+#endif
+#ifndef GL_HIGH_INT
+#define GL_HIGH_INT 0x8DF5
+#endif
+#ifndef GL_IMPLEMENTATION_COLOR_READ_FORMAT
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#endif
+#ifndef GL_IMPLEMENTATION_COLOR_READ_TYPE
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#endif
+#ifndef GL_INCR
+#define GL_INCR 0x1E02
+#endif
+#ifndef GL_INCR_WRAP
+#define GL_INCR_WRAP 0x8507
+#endif
+#ifndef GL_INFO_LOG_LENGTH
+#define GL_INFO_LOG_LENGTH 0x8B84
+#endif
+#ifndef GL_INT
+#define GL_INT 0x1404
+#endif
+#ifndef GL_INT_VEC2
+#define GL_INT_VEC2 0x8B53
+#endif
+#ifndef GL_INT_VEC3
+#define GL_INT_VEC3 0x8B54
+#endif
+#ifndef GL_INT_VEC4
+#define GL_INT_VEC4 0x8B55
+#endif
+#ifndef GL_INVALID_ENUM
+#define GL_INVALID_ENUM 0x0500
+#endif
+#ifndef GL_INVALID_FRAMEBUFFER_OPERATION
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+#endif
+#ifndef GL_INVALID_OPERATION
+#define GL_INVALID_OPERATION 0x0502
+#endif
+#ifndef GL_INVALID_VALUE
+#define GL_INVALID_VALUE 0x0501
+#endif
+#ifndef GL_INVERT
+#define GL_INVERT 0x150A
+#endif
+#ifndef GL_KEEP
+#define GL_KEEP 0x1E00
+#endif
+#ifndef GL_LEQUAL
+#define GL_LEQUAL 0x0203
+#endif
+#ifndef GL_LESS
+#define GL_LESS 0x0201
+#endif
+#ifndef GL_LINEAR
+#define GL_LINEAR 0x2601
+#endif
+#ifndef GL_LINEAR_MIPMAP_LINEAR
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#endif
+#ifndef GL_LINEAR_MIPMAP_NEAREST
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#endif
+#ifndef GL_LINE_LOOP
+#define GL_LINE_LOOP 0x0002
+#endif
+#ifndef GL_LINES
+#define GL_LINES 0x0001
+#endif
+#ifndef GL_LINE_STRIP
+#define GL_LINE_STRIP 0x0003
+#endif
+#ifndef GL_LINE_WIDTH
+#define GL_LINE_WIDTH 0x0B21
+#endif
+#ifndef GL_LINK_STATUS
+#define GL_LINK_STATUS 0x8B82
+#endif
+#ifndef GL_LOW_FLOAT
+#define GL_LOW_FLOAT 0x8DF0
+#endif
+#ifndef GL_LOW_INT
+#define GL_LOW_INT 0x8DF3
+#endif
+#ifndef GL_LUMINANCE
+#define GL_LUMINANCE 0x1909
+#endif
+#ifndef GL_LUMINANCE_ALPHA
+#define GL_LUMINANCE_ALPHA 0x190A
+#endif
+#ifndef GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#endif
+#ifndef GL_MAX_CUBE_MAP_TEXTURE_SIZE
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+#endif
+#ifndef GL_MAX_FRAGMENT_UNIFORM_VECTORS
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#endif
+#ifndef GL_MAX_RENDERBUFFER_SIZE
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#endif
+#ifndef GL_MAX_TEXTURE_IMAGE_UNITS
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#endif
+#ifndef GL_MAX_TEXTURE_SIZE
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#endif
+#ifndef GL_MAX_VARYING_VECTORS
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#endif
+#ifndef GL_MAX_VERTEX_ATTRIBS
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#endif
+#ifndef GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#endif
+#ifndef GL_MAX_VERTEX_UNIFORM_VECTORS
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#endif
+#ifndef GL_MAX_VIEWPORT_DIMS
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#endif
+#ifndef GL_MEDIUM_FLOAT
+#define GL_MEDIUM_FLOAT 0x8DF1
+#endif
+#ifndef GL_MEDIUM_INT
+#define GL_MEDIUM_INT 0x8DF4
+#endif
+#ifndef GL_MIRRORED_REPEAT
+#define GL_MIRRORED_REPEAT 0x8370
+#endif
+#ifndef GL_NEAREST
+#define GL_NEAREST 0x2600
+#endif
+#ifndef GL_NEAREST_MIPMAP_LINEAR
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#endif
+#ifndef GL_NEAREST_MIPMAP_NEAREST
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#endif
+#ifndef GL_NEVER
+#define GL_NEVER 0x0200
+#endif
+#ifndef GL_NICEST
+#define GL_NICEST 0x1102
+#endif
+#ifndef GL_NO_ERROR
+#define GL_NO_ERROR 0
+#endif
+#ifndef GL_NONE
+#define GL_NONE 0
+#endif
+#ifndef GL_NOTEQUAL
+#define GL_NOTEQUAL 0x0205
+#endif
+#ifndef GL_NUM_COMPRESSED_TEXTURE_FORMATS
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#endif
+#ifndef GL_NUM_SHADER_BINARY_FORMATS
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#endif
+#ifndef GL_ONE
+#define GL_ONE 1
+#endif
+#ifndef GL_ONE_MINUS_CONSTANT_ALPHA
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#endif
+#ifndef GL_ONE_MINUS_CONSTANT_COLOR
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#endif
+#ifndef GL_ONE_MINUS_DST_ALPHA
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#endif
+#ifndef GL_ONE_MINUS_DST_COLOR
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#endif
+#ifndef GL_ONE_MINUS_SRC_ALPHA
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#endif
+#ifndef GL_ONE_MINUS_SRC_COLOR
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#endif
+#ifndef GL_OUT_OF_MEMORY
+#define GL_OUT_OF_MEMORY 0x0505
+#endif
+#ifndef GL_PACK_ALIGNMENT
+#define GL_PACK_ALIGNMENT 0x0D05
+#endif
+#ifndef GL_POINTS
+#define GL_POINTS 0x0000
+#endif
+#ifndef GL_POLYGON_OFFSET_FACTOR
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#endif
+#ifndef GL_POLYGON_OFFSET_FILL
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#endif
+#ifndef GL_POLYGON_OFFSET_UNITS
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#endif
+#ifndef GL_RED_BITS
+#define GL_RED_BITS 0x0D52
+#endif
+#ifndef GL_RENDERBUFFER
+#define GL_RENDERBUFFER 0x8D41
+#endif
+#ifndef GL_RENDERBUFFER_ALPHA_SIZE
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#endif
+#ifndef GL_RENDERBUFFER_BINDING
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#endif
+#ifndef GL_RENDERBUFFER_BLUE_SIZE
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#endif
+#ifndef GL_RENDERBUFFER_DEPTH_SIZE
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#endif
+#ifndef GL_RENDERBUFFER_GREEN_SIZE
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#endif
+#ifndef GL_RENDERBUFFER_HEIGHT
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#endif
+#ifndef GL_RENDERBUFFER_INTERNAL_FORMAT
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#endif
+#ifndef GL_RENDERBUFFER_RED_SIZE
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#endif
+#ifndef GL_RENDERBUFFER_STENCIL_SIZE
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#endif
+#ifndef GL_RENDERBUFFER_WIDTH
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#endif
+#ifndef GL_RENDERER
+#define GL_RENDERER 0x1F01
+#endif
+#ifndef GL_REPEAT
+#define GL_REPEAT 0x2901
+#endif
+#ifndef GL_REPLACE
+#define GL_REPLACE 0x1E01
+#endif
+#ifndef GL_RGB
+#define GL_RGB 0x1907
+#endif
+#ifndef GL_RGB565
+#define GL_RGB565 0x8D62
+#endif
+#ifndef GL_RGB5_A1
+#define GL_RGB5_A1 0x8057
+#endif
+#ifndef GL_RGBA
+#define GL_RGBA 0x1908
+#endif
+#ifndef GL_RGBA4
+#define GL_RGBA4 0x8056
+#endif
+#ifndef GL_SAMPLE_ALPHA_TO_COVERAGE
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#endif
+#ifndef GL_SAMPLE_BUFFERS
+#define GL_SAMPLE_BUFFERS 0x80A8
+#endif
+#ifndef GL_SAMPLE_COVERAGE
+#define GL_SAMPLE_COVERAGE 0x80A0
+#endif
+#ifndef GL_SAMPLE_COVERAGE_INVERT
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#endif
+#ifndef GL_SAMPLE_COVERAGE_VALUE
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#endif
+#ifndef GL_SAMPLER_2D
+#define GL_SAMPLER_2D 0x8B5E
+#endif
+#ifndef GL_SAMPLER_CUBE
+#define GL_SAMPLER_CUBE 0x8B60
+#endif
+#ifndef GL_SAMPLES
+#define GL_SAMPLES 0x80A9
+#endif
+#ifndef GL_SCISSOR_BOX
+#define GL_SCISSOR_BOX 0x0C10
+#endif
+#ifndef GL_SCISSOR_TEST
+#define GL_SCISSOR_TEST 0x0C11
+#endif
+#ifndef GL_SHADER_BINARY_FORMATS
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#endif
+#ifndef GL_SHADER_COMPILER
+#define GL_SHADER_COMPILER 0x8DFA
+#endif
+#ifndef GL_SHADER_SOURCE_LENGTH
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#endif
+#ifndef GL_SHADER_TYPE
+#define GL_SHADER_TYPE 0x8B4F
+#endif
+#ifndef GL_SHADING_LANGUAGE_VERSION
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#endif
+#ifndef GL_SHORT
+#define GL_SHORT 0x1402
+#endif
+#ifndef GL_SRC_ALPHA
+#define GL_SRC_ALPHA 0x0302
+#endif
+#ifndef GL_SRC_ALPHA_SATURATE
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#endif
+#ifndef GL_SRC_COLOR
+#define GL_SRC_COLOR 0x0300
+#endif
+#ifndef GL_STATIC_DRAW
+#define GL_STATIC_DRAW 0x88E4
+#endif
+#ifndef GL_STENCIL_ATTACHMENT
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#endif
+#ifndef GL_STENCIL_BACK_FAIL
+#define GL_STENCIL_BACK_FAIL 0x8801
+#endif
+#ifndef GL_STENCIL_BACK_FUNC
+#define GL_STENCIL_BACK_FUNC 0x8800
+#endif
+#ifndef GL_STENCIL_BACK_PASS_DEPTH_FAIL
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#endif
+#ifndef GL_STENCIL_BACK_PASS_DEPTH_PASS
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#endif
+#ifndef GL_STENCIL_BACK_REF
+#define GL_STENCIL_BACK_REF 0x8CA3
+#endif
+#ifndef GL_STENCIL_BACK_VALUE_MASK
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#endif
+#ifndef GL_STENCIL_BACK_WRITEMASK
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#endif
+#ifndef GL_STENCIL_BITS
+#define GL_STENCIL_BITS 0x0D57
+#endif
+#ifndef GL_STENCIL_BUFFER_BIT
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#endif
+#ifndef GL_STENCIL_CLEAR_VALUE
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#endif
+#ifndef GL_STENCIL_FAIL
+#define GL_STENCIL_FAIL 0x0B94
+#endif
+#ifndef GL_STENCIL_FUNC
+#define GL_STENCIL_FUNC 0x0B92
+#endif
+#ifndef GL_STENCIL_INDEX
+#define GL_STENCIL_INDEX 0x1901
+#endif
+#ifndef GL_STENCIL_INDEX8
+#define GL_STENCIL_INDEX8 0x8D48
+#endif
+#ifndef GL_STENCIL_PASS_DEPTH_FAIL
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#endif
+#ifndef GL_STENCIL_PASS_DEPTH_PASS
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#endif
+#ifndef GL_STENCIL_REF
+#define GL_STENCIL_REF 0x0B97
+#endif
+#ifndef GL_STENCIL_TEST
+#define GL_STENCIL_TEST 0x0B90
+#endif
+#ifndef GL_STENCIL_VALUE_MASK
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#endif
+#ifndef GL_STENCIL_WRITEMASK
+#define GL_STENCIL_WRITEMASK 0x0B98
+#endif
+#ifndef GL_STREAM_DRAW
+#define GL_STREAM_DRAW 0x88E0
+#endif
+#ifndef GL_SUBPIXEL_BITS
+#define GL_SUBPIXEL_BITS 0x0D50
+#endif
+#ifndef GL_TEXTURE0
+#define GL_TEXTURE0 0x84C0
+#endif
+#ifndef GL_TEXTURE
+#define GL_TEXTURE 0x1702
+#endif
+#ifndef GL_TEXTURE10
+#define GL_TEXTURE10 0x84CA
+#endif
+#ifndef GL_TEXTURE1
+#define GL_TEXTURE1 0x84C1
+#endif
+#ifndef GL_TEXTURE11
+#define GL_TEXTURE11 0x84CB
+#endif
+#ifndef GL_TEXTURE12
+#define GL_TEXTURE12 0x84CC
+#endif
+#ifndef GL_TEXTURE13
+#define GL_TEXTURE13 0x84CD
+#endif
+#ifndef GL_TEXTURE14
+#define GL_TEXTURE14 0x84CE
+#endif
+#ifndef GL_TEXTURE15
+#define GL_TEXTURE15 0x84CF
+#endif
+#ifndef GL_TEXTURE16
+#define GL_TEXTURE16 0x84D0
+#endif
+#ifndef GL_TEXTURE17
+#define GL_TEXTURE17 0x84D1
+#endif
+#ifndef GL_TEXTURE18
+#define GL_TEXTURE18 0x84D2
+#endif
+#ifndef GL_TEXTURE19
+#define GL_TEXTURE19 0x84D3
+#endif
+#ifndef GL_TEXTURE20
+#define GL_TEXTURE20 0x84D4
+#endif
+#ifndef GL_TEXTURE2
+#define GL_TEXTURE2 0x84C2
+#endif
+#ifndef GL_TEXTURE21
+#define GL_TEXTURE21 0x84D5
+#endif
+#ifndef GL_TEXTURE22
+#define GL_TEXTURE22 0x84D6
+#endif
+#ifndef GL_TEXTURE23
+#define GL_TEXTURE23 0x84D7
+#endif
+#ifndef GL_TEXTURE24
+#define GL_TEXTURE24 0x84D8
+#endif
+#ifndef GL_TEXTURE25
+#define GL_TEXTURE25 0x84D9
+#endif
+#ifndef GL_TEXTURE26
+#define GL_TEXTURE26 0x84DA
+#endif
+#ifndef GL_TEXTURE27
+#define GL_TEXTURE27 0x84DB
+#endif
+#ifndef GL_TEXTURE28
+#define GL_TEXTURE28 0x84DC
+#endif
+#ifndef GL_TEXTURE29
+#define GL_TEXTURE29 0x84DD
+#endif
+#ifndef GL_TEXTURE_2D
+#define GL_TEXTURE_2D 0x0DE1
+#endif
+#ifndef GL_TEXTURE30
+#define GL_TEXTURE30 0x84DE
+#endif
+#ifndef GL_TEXTURE3
+#define GL_TEXTURE3 0x84C3
+#endif
+#ifndef GL_TEXTURE31
+#define GL_TEXTURE31 0x84DF
+#endif
+#ifndef GL_TEXTURE4
+#define GL_TEXTURE4 0x84C4
+#endif
+#ifndef GL_TEXTURE5
+#define GL_TEXTURE5 0x84C5
+#endif
+#ifndef GL_TEXTURE6
+#define GL_TEXTURE6 0x84C6
+#endif
+#ifndef GL_TEXTURE7
+#define GL_TEXTURE7 0x84C7
+#endif
+#ifndef GL_TEXTURE8
+#define GL_TEXTURE8 0x84C8
+#endif
+#ifndef GL_TEXTURE9
+#define GL_TEXTURE9 0x84C9
+#endif
+#ifndef GL_TEXTURE_BINDING_2D
+#define GL_TEXTURE_BINDING_2D 0x8069
+#endif
+#ifndef GL_TEXTURE_BINDING_CUBE_MAP
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#endif
+#ifndef GL_TEXTURE_CUBE_MAP
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#endif
+#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_X
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#endif
+#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#endif
+#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#endif
+#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_X
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#endif
+#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Y
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#endif
+#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Z
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#endif
+#ifndef GL_TEXTURE_MAG_FILTER
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#endif
+#ifndef GL_TEXTURE_MIN_FILTER
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#endif
+#ifndef GL_TEXTURE_WRAP_S
+#define GL_TEXTURE_WRAP_S 0x2802
+#endif
+#ifndef GL_TEXTURE_WRAP_T
+#define GL_TEXTURE_WRAP_T 0x2803
+#endif
+#ifndef GL_TRIANGLE_FAN
+#define GL_TRIANGLE_FAN 0x0006
+#endif
+#ifndef GL_TRIANGLES
+#define GL_TRIANGLES 0x0004
+#endif
+#ifndef GL_TRIANGLE_STRIP
+#define GL_TRIANGLE_STRIP 0x0005
+#endif
+#ifndef GL_TRUE
+#define GL_TRUE 1
+#endif
+#ifndef GL_UNPACK_ALIGNMENT
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#endif
+#ifndef GL_UNSIGNED_BYTE
+#define GL_UNSIGNED_BYTE 0x1401
+#endif
+#ifndef GL_UNSIGNED_INT
+#define GL_UNSIGNED_INT 0x1405
+#endif
+#ifndef GL_UNSIGNED_SHORT
+#define GL_UNSIGNED_SHORT 0x1403
+#endif
+#ifndef GL_UNSIGNED_SHORT_4_4_4_4
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#endif
+#ifndef GL_UNSIGNED_SHORT_5_5_5_1
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#endif
+#ifndef GL_UNSIGNED_SHORT_5_6_5
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#endif
+#ifndef GL_VALIDATE_STATUS
+#define GL_VALIDATE_STATUS 0x8B83
+#endif
+#ifndef GL_VENDOR
+#define GL_VENDOR 0x1F00
+#endif
+#ifndef GL_VERSION
+#define GL_VERSION 0x1F02
+#endif
+#ifndef GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+#endif
+#ifndef GL_VERTEX_ATTRIB_ARRAY_ENABLED
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#endif
+#ifndef GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#endif
+#ifndef GL_VERTEX_ATTRIB_ARRAY_POINTER
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#endif
+#ifndef GL_VERTEX_ATTRIB_ARRAY_SIZE
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#endif
+#ifndef GL_VERTEX_ATTRIB_ARRAY_STRIDE
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#endif
+#ifndef GL_VERTEX_ATTRIB_ARRAY_TYPE
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#endif
+#ifndef GL_VERTEX_SHADER
+#define GL_VERTEX_SHADER 0x8B31
+#endif
+#ifndef GL_VIEWPORT
+#define GL_VIEWPORT 0x0BA2
+#endif
+#ifndef GL_ZERO
+#define GL_ZERO 0
+#endif
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/tests/auto/opengl.pro b/tests/auto/opengl.pro
index 9b59cd1..6c8e4ca 100644
--- a/tests/auto/opengl.pro
+++ b/tests/auto/opengl.pro
@@ -3,4 +3,5 @@ SUBDIRS=\
     qgl \
     qglthreads \
     qglbuffer \
+    qglfunctions \
 
diff --git a/tests/auto/qglfunctions/qglfunctions.pro b/tests/auto/qglfunctions/qglfunctions.pro
new file mode 100644
index 0000000..aa81547
--- /dev/null
+++ b/tests/auto/qglfunctions/qglfunctions.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+requires(contains(QT_CONFIG,opengl))
+QT += opengl
+
+win32:!wince*: DEFINES += QT_NO_EGL
+
+SOURCES += tst_qglfunctions.cpp
diff --git a/tests/auto/qglfunctions/tst_qglfunctions.cpp b/tests/auto/qglfunctions/tst_qglfunctions.cpp
new file mode 100644
index 0000000..8d6be73
--- /dev/null
+++ b/tests/auto/qglfunctions/tst_qglfunctions.cpp
@@ -0,0 +1,238 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtOpenGL/qglfunctions.h>
+
+class tst_QGLFunctions : public QObject
+{
+    Q_OBJECT
+public:
+    tst_QGLFunctions() {}
+    ~tst_QGLFunctions() {}
+
+private slots:
+    void features();
+    void multitexture();
+    void blendColor();
+
+private:
+    static bool hasExtension(const char *name);
+};
+
+bool tst_QGLFunctions::hasExtension(const char *name)
+{
+    QString extensions =
+        QString::fromLatin1
+            (reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
+    return extensions.split(QLatin1Char(' ')).contains
+        (QString::fromLatin1(name));
+}
+
+// Check that the reported features are consistent with the platform.
+void tst_QGLFunctions::features()
+{
+    // Before being associated with a context, there should be
+    // no features enabled.
+    QGLFunctions funcs;
+    QVERIFY(!funcs.openGLFeatures());
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Multitexture));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Shaders));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Buffers));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Framebuffers));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendColor));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendEquation));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Multisample));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures));
+
+    // Make a context current.
+    QGLWidget glw;
+    glw.makeCurrent();
+    funcs.initializeGLFunctions();
+
+    // Validate the features against what we expect for this platform.
+#if defined(QT_OPENGL_ES_2)
+    QGLFunctions::OpenGLFeatures allFeatures =
+        (QGLFunctions::Multitexture |
+         QGLFunctions::Shaders |
+         QGLFunctions::Buffers |
+         QGLFunctions::Framebuffers |
+         QGLFunctions::BlendColor |
+         QGLFunctions::BlendEquation |
+         QGLFunctions::BlendEquationSeparate |
+         QGLFunctions::BlendFuncSeparate |
+         QGLFunctions::BlendSubtract |
+         QGLFunctions::CompressedTextures |
+         QGLFunctions::Multisample |
+         QGLFunctions::StencilSeparate |
+         QGLFunctions::NPOTTextures);
+    QVERIFY((funcs.openGLFeatures() & allFeatures) == allFeatures);
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multitexture));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Shaders));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Buffers));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendColor));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendEquation));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multisample));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures));
+#elif defined(QT_OPENGL_ES)
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multitexture));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Buffers));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures));
+    QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multisample));
+
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Shaders));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendColor));
+    QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate));
+
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers),
+             hasExtension("GL_OES_framebuffer_object"));
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate),
+             hasExtension("GL_OES_blend_equation_separate"));
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate),
+             hasExtension("GL_OES_blend_func_separate"));
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract),
+             hasExtension("GL_OES_blend_subtract"));
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures),
+             hasExtension("GL_OES_texture_npot"));
+#else
+    // We check for both the extension name and the minimum OpenGL version
+    // for the feature.  This will help us catch situations where a platform
+    // doesn't list an extension by name but does have the feature by virtue
+    // of its version number.
+    QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags();
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Multitexture),
+             hasExtension("GL_ARB_multitexture") ||
+             (versions & QGLFormat::OpenGL_Version_1_3) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Shaders),
+             hasExtension("GL_ARB_shader_objects") ||
+             (versions & QGLFormat::OpenGL_Version_2_0) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Buffers),
+             (versions & QGLFormat::OpenGL_Version_1_5) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers),
+             hasExtension("GL_EXT_framebuffer_object") ||
+             hasExtension("GL_ARB_framebuffer_object"));
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendColor),
+             hasExtension("GL_EXT_blend_color") ||
+             (versions & QGLFormat::OpenGL_Version_1_2) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquation),
+             (versions & QGLFormat::OpenGL_Version_1_2) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate),
+             hasExtension("GL_EXT_blend_equation_separate") ||
+             (versions & QGLFormat::OpenGL_Version_2_0) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate),
+             hasExtension("GL_EXT_blend_func_separate") ||
+             (versions & QGLFormat::OpenGL_Version_1_4) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract),
+             hasExtension("GL_EXT_blend_subtract"));
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures),
+             hasExtension("GL_ARB_texture_compression") ||
+             (versions & QGLFormat::OpenGL_Version_1_3) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Multisample),
+             hasExtension("GL_ARB_multisample") ||
+             (versions & QGLFormat::OpenGL_Version_1_3) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate),
+             (versions & QGLFormat::OpenGL_Version_2_0) != 0);
+    QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures),
+             hasExtension("GL_ARB_texture_non_power_of_two") ||
+             (versions & QGLFormat::OpenGL_Version_2_0) != 0);
+#endif
+}
+
+// Verify that the multitexture functions appear to resolve and work.
+void tst_QGLFunctions::multitexture()
+{
+    QGLFunctions funcs;
+    QGLWidget glw;
+    glw.makeCurrent();
+    funcs.initializeGLFunctions();
+
+    if (!funcs.hasOpenGLFeature(QGLFunctions::Multitexture))
+        QSKIP("Multitexture functions are not supported", SkipSingle);
+
+    funcs.glActiveTexture(GL_TEXTURE1);
+
+    GLint active = 0;
+    glGetIntegerv(GL_ACTIVE_TEXTURE, &active);
+    QVERIFY(active == GL_TEXTURE1);
+
+    funcs.glActiveTexture(GL_TEXTURE0);
+
+    active = 0;
+    glGetIntegerv(GL_ACTIVE_TEXTURE, &active);
+    QVERIFY(active == GL_TEXTURE0);
+}
+
+// Verify that the glBlendColor() function appears to resolve and work.
+void tst_QGLFunctions::blendColor()
+{
+    QGLFunctions funcs;
+    QGLWidget glw;
+    glw.makeCurrent();
+    funcs.initializeGLFunctions();
+
+    if (!funcs.hasOpenGLFeature(QGLFunctions::BlendColor))
+        QSKIP("glBlendColor() is not supported", SkipSingle);
+
+    funcs.glBlendColor(0.0f, 1.0f, 0.0f, 1.0f);
+
+    GLfloat colors[4] = {0.5f, 0.5f, 0.5f, 0.5f};
+    glGetFloatv(GL_BLEND_COLOR, colors);
+
+    QCOMPARE(colors[0], 0.0f);
+    QCOMPARE(colors[1], 1.0f);
+    QCOMPARE(colors[2], 0.0f);
+    QCOMPARE(colors[3], 1.0f);
+}
+
+QTEST_MAIN(tst_QGLFunctions)
+
+#include "tst_qglfunctions.moc"
-- 
cgit v0.12


From 1efed3f163164a9c98b4ea7d747507b6fdc52d63 Mon Sep 17 00:00:00 2001
From: Rhys Weatherley <rhys.weatherley@nokia.com>
Date: Fri, 13 Aug 2010 12:18:50 +1000
Subject: Don't run QGLFunctions tests if cannot create context

---
 tests/auto/qglfunctions/tst_qglfunctions.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/auto/qglfunctions/tst_qglfunctions.cpp b/tests/auto/qglfunctions/tst_qglfunctions.cpp
index 8d6be73..73e63b5 100644
--- a/tests/auto/qglfunctions/tst_qglfunctions.cpp
+++ b/tests/auto/qglfunctions/tst_qglfunctions.cpp
@@ -90,6 +90,8 @@ void tst_QGLFunctions::features()
 
     // Make a context current.
     QGLWidget glw;
+    if (!glw.isValid())
+        QSKIP("Could not create a GL context", SkipAll);
     glw.makeCurrent();
     funcs.initializeGLFunctions();
 
@@ -192,6 +194,8 @@ void tst_QGLFunctions::multitexture()
 {
     QGLFunctions funcs;
     QGLWidget glw;
+    if (!glw.isValid())
+        QSKIP("Could not create a GL context", SkipAll);
     glw.makeCurrent();
     funcs.initializeGLFunctions();
 
@@ -216,6 +220,8 @@ void tst_QGLFunctions::blendColor()
 {
     QGLFunctions funcs;
     QGLWidget glw;
+    if (!glw.isValid())
+        QSKIP("Could not create a GL context", SkipAll);
     glw.makeCurrent();
     funcs.initializeGLFunctions();
 
-- 
cgit v0.12