Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:08:14

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QOPENGLFUNCTIONS_H
0005 #define QOPENGLFUNCTIONS_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 
0009 #ifndef QT_NO_OPENGL
0010 
0011 #ifdef __GLEW_H__
0012 #if defined(Q_CC_GNU)
0013 #warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
0014 #warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h
0015 #endif
0016 #endif
0017 
0018 #include <QtGui/qopengl.h>
0019 #include <QtGui/qopenglcontext.h>
0020 
0021 //#define Q_ENABLE_OPENGL_FUNCTIONS_DEBUG
0022 
0023 #if QT_CONFIG(opengles2)
0024 typedef double GLdouble;
0025 #endif
0026 
0027 #ifdef Q_ENABLE_OPENGL_FUNCTIONS_DEBUG
0028 #include <stdio.h>
0029 #define Q_OPENGL_FUNCTIONS_DEBUG \
0030     GLenum error = glGetError(); \
0031     if (error != GL_NO_ERROR) { \
0032         unsigned clamped = qMin(unsigned(error - GL_INVALID_ENUM), 4U); \
0033         const char *errors[] = { "GL_INVALID_ENUM", "GL_INVALID_VALUE", "GL_INVALID_OPERATION", "Unknown" }; \
0034         printf("GL error at %s:%d: %s\n", __FILE__, __LINE__, errors[clamped]); \
0035         int *value = nullptr; \
0036         *value = 0; \
0037     }
0038 #else
0039 #define Q_OPENGL_FUNCTIONS_DEBUG
0040 #endif
0041 
0042 QT_BEGIN_NAMESPACE
0043 
0044 struct QOpenGLFunctionsPrivate;
0045 
0046 // Undefine any macros from GLEW, qopenglextensions_p.h, etc that
0047 // may interfere with the definition of QOpenGLFunctions.
0048 #undef glBindTexture
0049 #undef glBlendFunc
0050 #undef glClear
0051 #undef glClearColor
0052 #undef glClearStencil
0053 #undef glColorMask
0054 #undef glCopyTexImage2D
0055 #undef glCopyTexSubImage2D
0056 #undef glCullFace
0057 #undef glDeleteTextures
0058 #undef glDepthFunc
0059 #undef glDepthMask
0060 #undef glDisable
0061 #undef glDrawArrays
0062 #undef glDrawElements
0063 #undef glEnable
0064 #undef glFinish
0065 #undef glFlush
0066 #undef glFrontFace
0067 #undef glGenTextures
0068 #undef glGetBooleanv
0069 #undef glGetError
0070 #undef glGetFloatv
0071 #undef glGetIntegerv
0072 #undef glGetString
0073 #undef glGetTexParameterfv
0074 #undef glGetTexParameteriv
0075 #undef glHint
0076 #undef glIsEnabled
0077 #undef glIsTexture
0078 #undef glLineWidth
0079 #undef glPixelStorei
0080 #undef glPolygonOffset
0081 #undef glReadPixels
0082 #undef glScissor
0083 #undef glStencilFunc
0084 #undef glStencilMask
0085 #undef glStencilOp
0086 #undef glTexImage2D
0087 #undef glTexParameterf
0088 #undef glTexParameterfv
0089 #undef glTexParameteri
0090 #undef glTexParameteriv
0091 #undef glTexSubImage2D
0092 #undef glViewport
0093 
0094 #undef glActiveTexture
0095 #undef glAttachShader
0096 #undef glBindAttribLocation
0097 #undef glBindBuffer
0098 #undef glBindFramebuffer
0099 #undef glBindRenderbuffer
0100 #undef glBlendColor
0101 #undef glBlendEquation
0102 #undef glBlendEquationSeparate
0103 #undef glBlendFuncSeparate
0104 #undef glBufferData
0105 #undef glBufferSubData
0106 #undef glCheckFramebufferStatus
0107 #undef glClearDepthf
0108 #undef glCompileShader
0109 #undef glCompressedTexImage2D
0110 #undef glCompressedTexSubImage2D
0111 #undef glCreateProgram
0112 #undef glCreateShader
0113 #undef glDeleteBuffers
0114 #undef glDeleteFramebuffers
0115 #undef glDeleteProgram
0116 #undef glDeleteRenderbuffers
0117 #undef glDeleteShader
0118 #undef glDepthRangef
0119 #undef glDetachShader
0120 #undef glDisableVertexAttribArray
0121 #undef glEnableVertexAttribArray
0122 #undef glFramebufferRenderbuffer
0123 #undef glFramebufferTexture2D
0124 #undef glGenBuffers
0125 #undef glGenerateMipmap
0126 #undef glGenFramebuffers
0127 #undef glGenRenderbuffers
0128 #undef glGetActiveAttrib
0129 #undef glGetActiveUniform
0130 #undef glGetAttachedShaders
0131 #undef glGetAttribLocation
0132 #undef glGetBufferParameteriv
0133 #undef glGetFramebufferAttachmentParameteriv
0134 #undef glGetProgramiv
0135 #undef glGetProgramInfoLog
0136 #undef glGetRenderbufferParameteriv
0137 #undef glGetShaderiv
0138 #undef glGetShaderInfoLog
0139 #undef glGetShaderPrecisionFormat
0140 #undef glGetShaderSource
0141 #undef glGetUniformfv
0142 #undef glGetUniformiv
0143 #undef glGetUniformLocation
0144 #undef glGetVertexAttribfv
0145 #undef glGetVertexAttribiv
0146 #undef glGetVertexAttribPointerv
0147 #undef glIsBuffer
0148 #undef glIsFramebuffer
0149 #undef glIsProgram
0150 #undef glIsRenderbuffer
0151 #undef glIsShader
0152 #undef glLinkProgram
0153 #undef glReleaseShaderCompiler
0154 #undef glRenderbufferStorage
0155 #undef glSampleCoverage
0156 #undef glShaderBinary
0157 #undef glShaderSource
0158 #undef glStencilFuncSeparate
0159 #undef glStencilMaskSeparate
0160 #undef glStencilOpSeparate
0161 #undef glUniform1f
0162 #undef glUniform1fv
0163 #undef glUniform1i
0164 #undef glUniform1iv
0165 #undef glUniform2f
0166 #undef glUniform2fv
0167 #undef glUniform2i
0168 #undef glUniform2iv
0169 #undef glUniform3f
0170 #undef glUniform3fv
0171 #undef glUniform3i
0172 #undef glUniform3iv
0173 #undef glUniform4f
0174 #undef glUniform4fv
0175 #undef glUniform4i
0176 #undef glUniform4iv
0177 #undef glUniformMatrix2fv
0178 #undef glUniformMatrix3fv
0179 #undef glUniformMatrix4fv
0180 #undef glUseProgram
0181 #undef glValidateProgram
0182 #undef glVertexAttrib1f
0183 #undef glVertexAttrib1fv
0184 #undef glVertexAttrib2f
0185 #undef glVertexAttrib2fv
0186 #undef glVertexAttrib3f
0187 #undef glVertexAttrib3fv
0188 #undef glVertexAttrib4f
0189 #undef glVertexAttrib4fv
0190 #undef glVertexAttribPointer
0191 
0192 #undef glTexLevelParameteriv
0193 
0194 #if defined(Q_QDOC)
0195 #undef GLbitfield
0196 typedef unsigned int GLbitfield;
0197 #undef GLchar
0198 typedef char GLchar;
0199 #endif
0200 
0201 class Q_GUI_EXPORT QOpenGLFunctions
0202 {
0203 public:
0204     QOpenGLFunctions();
0205     explicit QOpenGLFunctions(QOpenGLContext *context);
0206     ~QOpenGLFunctions() {}
0207 
0208     enum OpenGLFeature
0209     {
0210         Multitexture          = 0x0001,
0211         Shaders               = 0x0002,
0212         Buffers               = 0x0004,
0213         Framebuffers          = 0x0008,
0214         BlendColor            = 0x0010,
0215         BlendEquation         = 0x0020,
0216         BlendEquationSeparate = 0x0040,
0217         BlendFuncSeparate     = 0x0080,
0218         BlendSubtract         = 0x0100,
0219         CompressedTextures    = 0x0200,
0220         Multisample           = 0x0400,
0221         StencilSeparate       = 0x0800,
0222         NPOTTextures          = 0x1000,
0223         NPOTTextureRepeat     = 0x2000,
0224         FixedFunctionPipeline = 0x4000,
0225         TextureRGFormats      = 0x8000,
0226         MultipleRenderTargets = 0x10000,
0227         BlendEquationAdvanced = 0x20000,
0228     };
0229     Q_DECLARE_FLAGS(OpenGLFeatures, OpenGLFeature)
0230 
0231     QOpenGLFunctions::OpenGLFeatures openGLFeatures() const;
0232     bool hasOpenGLFeature(QOpenGLFunctions::OpenGLFeature feature) const;
0233 
0234     void initializeOpenGLFunctions();
0235 
0236     // GLES2 + OpenGL1 common subset
0237     void glBindTexture(GLenum target, GLuint texture);
0238     void glBlendFunc(GLenum sfactor, GLenum dfactor);
0239     void glClear(GLbitfield mask);
0240     void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
0241     void glClearStencil(GLint s);
0242     void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
0243     void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
0244     void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
0245     void glCullFace(GLenum mode);
0246     void glDeleteTextures(GLsizei n, const GLuint* textures);
0247     void glDepthFunc(GLenum func);
0248     void glDepthMask(GLboolean flag);
0249     void glDisable(GLenum cap);
0250     void glDrawArrays(GLenum mode, GLint first, GLsizei count);
0251     void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
0252     void glEnable(GLenum cap);
0253     void glFinish();
0254     void glFlush();
0255     void glFrontFace(GLenum mode);
0256     void glGenTextures(GLsizei n, GLuint* textures);
0257     void glGetBooleanv(GLenum pname, GLboolean* params);
0258     GLenum glGetError();
0259     void glGetFloatv(GLenum pname, GLfloat* params);
0260     void glGetIntegerv(GLenum pname, GLint* params);
0261     const GLubyte *glGetString(GLenum name);
0262     void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
0263     void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
0264     void glHint(GLenum target, GLenum mode);
0265     GLboolean glIsEnabled(GLenum cap);
0266     GLboolean glIsTexture(GLuint texture);
0267     void glLineWidth(GLfloat width);
0268     void glPixelStorei(GLenum pname, GLint param);
0269     void glPolygonOffset(GLfloat factor, GLfloat units);
0270     void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
0271     void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
0272     void glStencilFunc(GLenum func, GLint ref, GLuint mask);
0273     void glStencilMask(GLuint mask);
0274     void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
0275     void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
0276     void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
0277     void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
0278     void glTexParameteri(GLenum target, GLenum pname, GLint param);
0279     void glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
0280     void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
0281     void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
0282 
0283     // GL(ES)2
0284     void glActiveTexture(GLenum texture);
0285     void glAttachShader(GLuint program, GLuint shader);
0286     void glBindAttribLocation(GLuint program, GLuint index, const char* name);
0287     void glBindBuffer(GLenum target, GLuint buffer);
0288     void glBindFramebuffer(GLenum target, GLuint framebuffer);
0289     void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
0290     void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
0291     void glBlendEquation(GLenum mode);
0292     void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
0293     void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
0294     void glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage);
0295     void glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data);
0296     GLenum glCheckFramebufferStatus(GLenum target);
0297     void glClearDepthf(GLclampf depth);
0298     void glCompileShader(GLuint shader);
0299     void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
0300     void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
0301     GLuint glCreateProgram();
0302     GLuint glCreateShader(GLenum type);
0303     void glDeleteBuffers(GLsizei n, const GLuint* buffers);
0304     void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
0305     void glDeleteProgram(GLuint program);
0306     void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
0307     void glDeleteShader(GLuint shader);
0308     void glDepthRangef(GLclampf zNear, GLclampf zFar);
0309     void glDetachShader(GLuint program, GLuint shader);
0310     void glDisableVertexAttribArray(GLuint index);
0311     void glEnableVertexAttribArray(GLuint index);
0312     void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
0313     void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
0314     void glGenBuffers(GLsizei n, GLuint* buffers);
0315     void glGenerateMipmap(GLenum target);
0316     void glGenFramebuffers(GLsizei n, GLuint* framebuffers);
0317     void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers);
0318     void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
0319     void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
0320     void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
0321     GLint glGetAttribLocation(GLuint program, const char* name);
0322     void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
0323     void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
0324     void glGetProgramiv(GLuint program, GLenum pname, GLint* params);
0325     void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
0326     void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
0327     void glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
0328     void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
0329     void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
0330     void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
0331     void glGetUniformfv(GLuint program, GLint location, GLfloat* params);
0332     void glGetUniformiv(GLuint program, GLint location, GLint* params);
0333     GLint glGetUniformLocation(GLuint program, const char* name);
0334     void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
0335     void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
0336     void glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer);
0337     GLboolean glIsBuffer(GLuint buffer);
0338     GLboolean glIsFramebuffer(GLuint framebuffer);
0339     GLboolean glIsProgram(GLuint program);
0340     GLboolean glIsRenderbuffer(GLuint renderbuffer);
0341     GLboolean glIsShader(GLuint shader);
0342     void glLinkProgram(GLuint program);
0343     void glReleaseShaderCompiler();
0344     void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
0345     void glSampleCoverage(GLclampf value, GLboolean invert);
0346     void glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
0347     void glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length);
0348     void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
0349     void glStencilMaskSeparate(GLenum face, GLuint mask);
0350     void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
0351     void glUniform1f(GLint location, GLfloat x);
0352     void glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
0353     void glUniform1i(GLint location, GLint x);
0354     void glUniform1iv(GLint location, GLsizei count, const GLint* v);
0355     void glUniform2f(GLint location, GLfloat x, GLfloat y);
0356     void glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
0357     void glUniform2i(GLint location, GLint x, GLint y);
0358     void glUniform2iv(GLint location, GLsizei count, const GLint* v);
0359     void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
0360     void glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
0361     void glUniform3i(GLint location, GLint x, GLint y, GLint z);
0362     void glUniform3iv(GLint location, GLsizei count, const GLint* v);
0363     void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
0364     void glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
0365     void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
0366     void glUniform4iv(GLint location, GLsizei count, const GLint* v);
0367     void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
0368     void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
0369     void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
0370     void glUseProgram(GLuint program);
0371     void glValidateProgram(GLuint program);
0372     void glVertexAttrib1f(GLuint indx, GLfloat x);
0373     void glVertexAttrib1fv(GLuint indx, const GLfloat* values);
0374     void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
0375     void glVertexAttrib2fv(GLuint indx, const GLfloat* values);
0376     void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
0377     void glVertexAttrib3fv(GLuint indx, const GLfloat* values);
0378     void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
0379     void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
0380     void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
0381 
0382 protected:
0383     QOpenGLFunctionsPrivate *d_ptr;
0384     static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != nullptr; }
0385 };
0386 
0387 Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLFunctions::OpenGLFeatures)
0388 
0389 #define QT_OPENGL_DECLARE_FUNCTIONS(ret, name, args) \
0390     ret (QOPENGLF_APIENTRYP name)args;
0391 #define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
0392 
0393 #define QT_OPENGL_DECLARE(FUNCTIONS) \
0394 public: \
0395     struct Functions { \
0396         FUNCTIONS(QT_OPENGL_DECLARE_FUNCTIONS) \
0397     }; \
0398     union { \
0399         QFunctionPointer functions[FUNCTIONS(QT_OPENGL_COUNT_FUNCTIONS)]; \
0400         Functions f; \
0401     }; \
0402 private: \
0403     void init(QOpenGLContext *context);
0404 
0405 struct QOpenGLFunctionsPrivate
0406 {
0407     QOpenGLFunctionsPrivate(QOpenGLContext *ctx);
0408 
0409 #define QT_OPENGL_FUNCTIONS(F) \
0410     F(void, BindTexture, (GLenum target, GLuint texture)) \
0411     F(void, BlendFunc, (GLenum sfactor, GLenum dfactor)) \
0412     F(void, Clear, (GLbitfield mask)) \
0413     F(void, ClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \
0414     F(void, ClearDepthf, (GLclampf depth)) \
0415     F(void, ClearStencil, (GLint s)) \
0416     F(void, ColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) \
0417     F(void, CopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) \
0418     F(void, CopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \
0419     F(void, CullFace, (GLenum mode)) \
0420     F(void, DeleteTextures, (GLsizei n, const GLuint* textures)) \
0421     F(void, DepthFunc, (GLenum func)) \
0422     F(void, DepthMask, (GLboolean flag)) \
0423     F(void, DepthRangef, (GLclampf nearVal, GLclampf farVal)) \
0424     F(void, Disable, (GLenum cap)) \
0425     F(void, DrawArrays, (GLenum mode, GLint first, GLsizei count)) \
0426     F(void, DrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)) \
0427     F(void, Enable, (GLenum cap)) \
0428     F(void, Finish, ()) \
0429     F(void, Flush, ()) \
0430     F(void, FrontFace, (GLenum mode)) \
0431     F(void, GenTextures, (GLsizei n, GLuint* textures)) \
0432     F(void, GetBooleanv, (GLenum pname, GLboolean* params)) \
0433     F(GLenum, GetError, ()) \
0434     F(void, GetFloatv, (GLenum pname, GLfloat* params)) \
0435     F(void, GetIntegerv, (GLenum pname, GLint* params)) \
0436     F(const GLubyte *, GetString, (GLenum name)) \
0437     F(void, GetTexParameterfv, (GLenum target, GLenum pname, GLfloat* params)) \
0438     F(void, GetTexParameteriv, (GLenum target, GLenum pname, GLint* params)) \
0439     F(void, Hint, (GLenum target, GLenum mode)) \
0440     F(GLboolean, IsEnabled, (GLenum cap)) \
0441     F(GLboolean, IsTexture, (GLuint texture)) \
0442     F(void, LineWidth, (GLfloat width)) \
0443     F(void, PixelStorei, (GLenum pname, GLint param)) \
0444     F(void, PolygonOffset, (GLfloat factor, GLfloat units)) \
0445     F(void, ReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)) \
0446     F(void, Scissor, (GLint x, GLint y, GLsizei width, GLsizei height)) \
0447     F(void, StencilFunc, (GLenum func, GLint ref, GLuint mask)) \
0448     F(void, StencilMask, (GLuint mask)) \
0449     F(void, StencilOp, (GLenum fail, GLenum zfail, GLenum zpass)) \
0450     F(void, TexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)) \
0451     F(void, TexParameterf, (GLenum target, GLenum pname, GLfloat param)) \
0452     F(void, TexParameterfv, (GLenum target, GLenum pname, const GLfloat* params)) \
0453     F(void, TexParameteri, (GLenum target, GLenum pname, GLint param)) \
0454     F(void, TexParameteriv, (GLenum target, GLenum pname, const GLint* params)) \
0455     F(void, TexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)) \
0456     F(void, Viewport, (GLint x, GLint y, GLsizei width, GLsizei height)) \
0457     F(void, ActiveTexture, (GLenum texture)) \
0458     F(void, AttachShader, (GLuint program, GLuint shader)) \
0459     F(void, BindAttribLocation, (GLuint program, GLuint index, const char* name)) \
0460     F(void, BindBuffer, (GLenum target, GLuint buffer)) \
0461     F(void, BindFramebuffer, (GLenum target, GLuint framebuffer)) \
0462     F(void, BindRenderbuffer, (GLenum target, GLuint renderbuffer)) \
0463     F(void, BlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \
0464     F(void, BlendEquation, (GLenum mode)) \
0465     F(void, BlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha)) \
0466     F(void, BlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)) \
0467     F(void, BufferData, (GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage)) \
0468     F(void, BufferSubData, (GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data)) \
0469     F(GLenum, CheckFramebufferStatus, (GLenum target)) \
0470     F(void, CompileShader, (GLuint shader)) \
0471     F(void, CompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)) \
0472     F(void, CompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)) \
0473     F(GLuint, CreateProgram, ()) \
0474     F(GLuint, CreateShader, (GLenum type)) \
0475     F(void, DeleteBuffers, (GLsizei n, const GLuint* buffers)) \
0476     F(void, DeleteFramebuffers, (GLsizei n, const GLuint* framebuffers)) \
0477     F(void, DeleteProgram, (GLuint program)) \
0478     F(void, DeleteRenderbuffers, (GLsizei n, const GLuint* renderbuffers)) \
0479     F(void, DeleteShader, (GLuint shader)) \
0480     F(void, DetachShader, (GLuint program, GLuint shader)) \
0481     F(void, DisableVertexAttribArray, (GLuint index)) \
0482     F(void, EnableVertexAttribArray, (GLuint index)) \
0483     F(void, FramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) \
0484     F(void, FramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) \
0485     F(void, GenBuffers, (GLsizei n, GLuint* buffers)) \
0486     F(void, GenerateMipmap, (GLenum target)) \
0487     F(void, GenFramebuffers, (GLsizei n, GLuint* framebuffers)) \
0488     F(void, GenRenderbuffers, (GLsizei n, GLuint* renderbuffers)) \
0489     F(void, GetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)) \
0490     F(void, GetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)) \
0491     F(void, GetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)) \
0492     F(GLint, GetAttribLocation, (GLuint program, const char* name)) \
0493     F(void, GetBufferParameteriv, (GLenum target, GLenum pname, GLint* params)) \
0494     F(void, GetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint* params)) \
0495     F(void, GetProgramiv, (GLuint program, GLenum pname, GLint* params)) \
0496     F(void, GetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)) \
0497     F(void, GetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint* params)) \
0498     F(void, GetShaderiv, (GLuint shader, GLenum pname, GLint* params)) \
0499     F(void, GetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)) \
0500     F(void, GetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)) \
0501     F(void, GetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, char* source)) \
0502     F(void, GetUniformfv, (GLuint program, GLint location, GLfloat* params)) \
0503     F(void, GetUniformiv, (GLuint program, GLint location, GLint* params)) \
0504     F(GLint, GetUniformLocation, (GLuint program, const char* name)) \
0505     F(void, GetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params)) \
0506     F(void, GetVertexAttribiv, (GLuint index, GLenum pname, GLint* params)) \
0507     F(void, GetVertexAttribPointerv, (GLuint index, GLenum pname, void** pointer)) \
0508     F(GLboolean, IsBuffer, (GLuint buffer)) \
0509     F(GLboolean, IsFramebuffer, (GLuint framebuffer)) \
0510     F(GLboolean, IsProgram, (GLuint program)) \
0511     F(GLboolean, IsRenderbuffer, (GLuint renderbuffer)) \
0512     F(GLboolean, IsShader, (GLuint shader)) \
0513     F(void, LinkProgram, (GLuint program)) \
0514     F(void, ReleaseShaderCompiler, ()) \
0515     F(void, RenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)) \
0516     F(void, SampleCoverage, (GLclampf value, GLboolean invert)) \
0517     F(void, ShaderBinary, (GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)) \
0518     F(void, ShaderSource, (GLuint shader, GLsizei count, const char** string, const GLint* length)) \
0519     F(void, StencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask)) \
0520     F(void, StencilMaskSeparate, (GLenum face, GLuint mask)) \
0521     F(void, StencilOpSeparate, (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)) \
0522     F(void, Uniform1f, (GLint location, GLfloat x)) \
0523     F(void, Uniform1fv, (GLint location, GLsizei count, const GLfloat* v)) \
0524     F(void, Uniform1i, (GLint location, GLint x)) \
0525     F(void, Uniform1iv, (GLint location, GLsizei count, const GLint* v)) \
0526     F(void, Uniform2f, (GLint location, GLfloat x, GLfloat y)) \
0527     F(void, Uniform2fv, (GLint location, GLsizei count, const GLfloat* v)) \
0528     F(void, Uniform2i, (GLint location, GLint x, GLint y)) \
0529     F(void, Uniform2iv, (GLint location, GLsizei count, const GLint* v)) \
0530     F(void, Uniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z)) \
0531     F(void, Uniform3fv, (GLint location, GLsizei count, const GLfloat* v)) \
0532     F(void, Uniform3i, (GLint location, GLint x, GLint y, GLint z)) \
0533     F(void, Uniform3iv, (GLint location, GLsizei count, const GLint* v)) \
0534     F(void, Uniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
0535     F(void, Uniform4fv, (GLint location, GLsizei count, const GLfloat* v)) \
0536     F(void, Uniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w)) \
0537     F(void, Uniform4iv, (GLint location, GLsizei count, const GLint* v)) \
0538     F(void, UniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
0539     F(void, UniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
0540     F(void, UniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
0541     F(void, UseProgram, (GLuint program)) \
0542     F(void, ValidateProgram, (GLuint program)) \
0543     F(void, VertexAttrib1f, (GLuint indx, GLfloat x)) \
0544     F(void, VertexAttrib1fv, (GLuint indx, const GLfloat* values)) \
0545     F(void, VertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y)) \
0546     F(void, VertexAttrib2fv, (GLuint indx, const GLfloat* values)) \
0547     F(void, VertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z)) \
0548     F(void, VertexAttrib3fv, (GLuint indx, const GLfloat* values)) \
0549     F(void, VertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
0550     F(void, VertexAttrib4fv, (GLuint indx, const GLfloat* values)) \
0551     F(void, VertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)) \
0552     F(void, ClearDepth, (GLdouble depth)) \
0553     F(void, DepthRange, (GLdouble zNear, GLdouble zFar)) \
0554 
0555     QT_OPENGL_DECLARE(QT_OPENGL_FUNCTIONS)
0556 };
0557 
0558 // GLES2 + OpenGL1 common subset
0559 
0560 inline void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture)
0561 {
0562 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0563     ::glBindTexture(target, texture);
0564 #else
0565     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0566     d_ptr->f.BindTexture(target, texture);
0567 #endif
0568     Q_OPENGL_FUNCTIONS_DEBUG
0569 }
0570 
0571 inline void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor)
0572 {
0573 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0574     ::glBlendFunc(sfactor, dfactor);
0575 #else
0576     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0577     d_ptr->f.BlendFunc(sfactor, dfactor);
0578 #endif
0579     Q_OPENGL_FUNCTIONS_DEBUG
0580 }
0581 
0582 inline void QOpenGLFunctions::glClear(GLbitfield mask)
0583 {
0584 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0585     ::glClear(mask);
0586 #else
0587     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0588     d_ptr->f.Clear(mask);
0589 #endif
0590     Q_OPENGL_FUNCTIONS_DEBUG
0591 }
0592 
0593 inline void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
0594 {
0595 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0596     ::glClearColor(red, green, blue, alpha);
0597 #else
0598     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0599     d_ptr->f.ClearColor(red, green, blue, alpha);
0600 #endif
0601     Q_OPENGL_FUNCTIONS_DEBUG
0602 }
0603 
0604 inline void QOpenGLFunctions::glClearStencil(GLint s)
0605 {
0606 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0607     ::glClearStencil(s);
0608 #else
0609     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0610     d_ptr->f.ClearStencil(s);
0611 #endif
0612     Q_OPENGL_FUNCTIONS_DEBUG
0613 }
0614 
0615 inline void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
0616 {
0617 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0618     ::glColorMask(red, green, blue, alpha);
0619 #else
0620     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0621     d_ptr->f.ColorMask(red, green, blue, alpha);
0622 #endif
0623     Q_OPENGL_FUNCTIONS_DEBUG
0624 }
0625 
0626 inline void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
0627 {
0628 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0629     ::glCopyTexImage2D(target, level, internalformat, x, y, width,height, border);
0630 #else
0631     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0632     d_ptr->f.CopyTexImage2D(target, level, internalformat, x, y, width,height, border);
0633 #endif
0634     Q_OPENGL_FUNCTIONS_DEBUG
0635 }
0636 
0637 inline void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
0638 {
0639 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0640     ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
0641 #else
0642     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0643     d_ptr->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
0644 #endif
0645     Q_OPENGL_FUNCTIONS_DEBUG
0646 }
0647 
0648 inline void QOpenGLFunctions::glCullFace(GLenum mode)
0649 {
0650 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0651     ::glCullFace(mode);
0652 #else
0653     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0654     d_ptr->f.CullFace(mode);
0655 #endif
0656     Q_OPENGL_FUNCTIONS_DEBUG
0657 }
0658 
0659 inline void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures)
0660 {
0661 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0662     ::glDeleteTextures(n, textures);
0663 #else
0664     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0665     d_ptr->f.DeleteTextures(n, textures);
0666 #endif
0667     Q_OPENGL_FUNCTIONS_DEBUG
0668 }
0669 
0670 inline void QOpenGLFunctions::glDepthFunc(GLenum func)
0671 {
0672 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0673     ::glDepthFunc(func);
0674 #else
0675     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0676     d_ptr->f.DepthFunc(func);
0677 #endif
0678     Q_OPENGL_FUNCTIONS_DEBUG
0679 }
0680 
0681 inline void QOpenGLFunctions::glDepthMask(GLboolean flag)
0682 {
0683 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0684     ::glDepthMask(flag);
0685 #else
0686     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0687     d_ptr->f.DepthMask(flag);
0688 #endif
0689     Q_OPENGL_FUNCTIONS_DEBUG
0690 }
0691 
0692 inline void QOpenGLFunctions::glDisable(GLenum cap)
0693 {
0694 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0695     ::glDisable(cap);
0696 #else
0697     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0698     d_ptr->f.Disable(cap);
0699 #endif
0700     Q_OPENGL_FUNCTIONS_DEBUG
0701 }
0702 
0703 inline void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count)
0704 {
0705 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0706     ::glDrawArrays(mode, first, count);
0707 #else
0708     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0709     d_ptr->f.DrawArrays(mode, first, count);
0710 #endif
0711     Q_OPENGL_FUNCTIONS_DEBUG
0712 }
0713 
0714 inline void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
0715 {
0716 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0717     ::glDrawElements(mode, count, type, indices);
0718 #else
0719     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0720     d_ptr->f.DrawElements(mode, count, type, indices);
0721 #endif
0722     Q_OPENGL_FUNCTIONS_DEBUG
0723 }
0724 
0725 inline void QOpenGLFunctions::glEnable(GLenum cap)
0726 {
0727 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0728     ::glEnable(cap);
0729 #else
0730     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0731     d_ptr->f.Enable(cap);
0732 #endif
0733     Q_OPENGL_FUNCTIONS_DEBUG
0734 }
0735 
0736 inline void QOpenGLFunctions::glFinish()
0737 {
0738 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0739     ::glFinish();
0740 #else
0741     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0742     d_ptr->f.Finish();
0743 #endif
0744     Q_OPENGL_FUNCTIONS_DEBUG
0745 }
0746 
0747 inline void QOpenGLFunctions::glFlush()
0748 {
0749 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0750     ::glFlush();
0751 #else
0752     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0753     d_ptr->f.Flush();
0754 #endif
0755     Q_OPENGL_FUNCTIONS_DEBUG
0756 }
0757 
0758 inline void QOpenGLFunctions::glFrontFace(GLenum mode)
0759 {
0760 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0761     ::glFrontFace(mode);
0762 #else
0763     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0764     d_ptr->f.FrontFace(mode);
0765 #endif
0766     Q_OPENGL_FUNCTIONS_DEBUG
0767 }
0768 
0769 inline void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures)
0770 {
0771 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0772     ::glGenTextures(n, textures);
0773 #else
0774     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0775     d_ptr->f.GenTextures(n, textures);
0776 #endif
0777     Q_OPENGL_FUNCTIONS_DEBUG
0778 }
0779 
0780 inline void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params)
0781 {
0782 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0783     ::glGetBooleanv(pname, params);
0784 #else
0785     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0786     d_ptr->f.GetBooleanv(pname, params);
0787 #endif
0788     Q_OPENGL_FUNCTIONS_DEBUG
0789 }
0790 
0791 inline GLenum QOpenGLFunctions::glGetError()
0792 {
0793 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0794     GLenum result = ::glGetError();
0795 #else
0796     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0797     GLenum result = d_ptr->f.GetError();
0798 #endif
0799     return result;
0800 }
0801 
0802 inline void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params)
0803 {
0804 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0805     ::glGetFloatv(pname, params);
0806 #else
0807     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0808     d_ptr->f.GetFloatv(pname, params);
0809 #endif
0810     Q_OPENGL_FUNCTIONS_DEBUG
0811 }
0812 
0813 inline void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params)
0814 {
0815 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0816     ::glGetIntegerv(pname, params);
0817 #else
0818     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0819     d_ptr->f.GetIntegerv(pname, params);
0820 #endif
0821     Q_OPENGL_FUNCTIONS_DEBUG
0822 }
0823 
0824 inline const GLubyte *QOpenGLFunctions::glGetString(GLenum name)
0825 {
0826 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0827     const GLubyte *result = ::glGetString(name);
0828 #else
0829     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0830     const GLubyte *result = d_ptr->f.GetString(name);
0831 #endif
0832     Q_OPENGL_FUNCTIONS_DEBUG
0833     return result;
0834 }
0835 
0836 inline void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
0837 {
0838 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0839     ::glGetTexParameterfv(target, pname, params);
0840 #else
0841     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0842     d_ptr->f.GetTexParameterfv(target, pname, params);
0843 #endif
0844     Q_OPENGL_FUNCTIONS_DEBUG
0845 }
0846 
0847 inline void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
0848 {
0849 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0850     ::glGetTexParameteriv(target, pname, params);
0851 #else
0852     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0853     d_ptr->f.GetTexParameteriv(target, pname, params);
0854 #endif
0855     Q_OPENGL_FUNCTIONS_DEBUG
0856 }
0857 
0858 inline void QOpenGLFunctions::glHint(GLenum target, GLenum mode)
0859 {
0860 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0861     ::glHint(target, mode);
0862 #else
0863     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0864     d_ptr->f.Hint(target, mode);
0865 #endif
0866     Q_OPENGL_FUNCTIONS_DEBUG
0867 }
0868 
0869 inline GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap)
0870 {
0871 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0872     GLboolean result = ::glIsEnabled(cap);
0873 #else
0874     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0875     GLboolean result = d_ptr->f.IsEnabled(cap);
0876 #endif
0877     Q_OPENGL_FUNCTIONS_DEBUG
0878     return result;
0879 }
0880 
0881 inline GLboolean QOpenGLFunctions::glIsTexture(GLuint texture)
0882 {
0883 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0884     GLboolean result = ::glIsTexture(texture);
0885 #else
0886     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0887     GLboolean result = d_ptr->f.IsTexture(texture);
0888 #endif
0889     Q_OPENGL_FUNCTIONS_DEBUG
0890     return result;
0891 }
0892 
0893 inline void QOpenGLFunctions::glLineWidth(GLfloat width)
0894 {
0895 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0896     ::glLineWidth(width);
0897 #else
0898     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0899     d_ptr->f.LineWidth(width);
0900 #endif
0901     Q_OPENGL_FUNCTIONS_DEBUG
0902 }
0903 
0904 inline void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param)
0905 {
0906 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0907     ::glPixelStorei(pname, param);
0908 #else
0909     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0910     d_ptr->f.PixelStorei(pname, param);
0911 #endif
0912     Q_OPENGL_FUNCTIONS_DEBUG
0913 }
0914 
0915 inline void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units)
0916 {
0917 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0918     ::glPolygonOffset(factor, units);
0919 #else
0920     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0921     d_ptr->f.PolygonOffset(factor, units);
0922 #endif
0923     Q_OPENGL_FUNCTIONS_DEBUG
0924 }
0925 
0926 inline void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
0927 {
0928 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0929     ::glReadPixels(x, y, width, height, format, type, pixels);
0930 #else
0931     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0932     d_ptr->f.ReadPixels(x, y, width, height, format, type, pixels);
0933 #endif
0934     Q_OPENGL_FUNCTIONS_DEBUG
0935 }
0936 
0937 inline void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
0938 {
0939 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0940     ::glScissor(x, y, width, height);
0941 #else
0942     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0943     d_ptr->f.Scissor(x, y, width, height);
0944 #endif
0945     Q_OPENGL_FUNCTIONS_DEBUG
0946 }
0947 
0948 inline void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask)
0949 {
0950 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0951     ::glStencilFunc(func, ref, mask);
0952 #else
0953     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0954     d_ptr->f.StencilFunc(func, ref, mask);
0955 #endif
0956     Q_OPENGL_FUNCTIONS_DEBUG
0957 }
0958 
0959 inline void QOpenGLFunctions::glStencilMask(GLuint mask)
0960 {
0961 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0962     ::glStencilMask(mask);
0963 #else
0964     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0965     d_ptr->f.StencilMask(mask);
0966 #endif
0967     Q_OPENGL_FUNCTIONS_DEBUG
0968 }
0969 
0970 inline void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
0971 {
0972 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0973     ::glStencilOp(fail, zfail, zpass);
0974 #else
0975     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0976     d_ptr->f.StencilOp(fail, zfail, zpass);
0977 #endif
0978     Q_OPENGL_FUNCTIONS_DEBUG
0979 }
0980 
0981 inline void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
0982 {
0983 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0984     ::glTexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
0985 #else
0986     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0987     d_ptr->f.TexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
0988 #endif
0989     Q_OPENGL_FUNCTIONS_DEBUG
0990 }
0991 
0992 inline void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
0993 {
0994 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
0995     ::glTexParameterf(target, pname, param);
0996 #else
0997     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
0998     d_ptr->f.TexParameterf(target, pname, param);
0999 #endif
1000     Q_OPENGL_FUNCTIONS_DEBUG
1001 }
1002 
1003 inline void QOpenGLFunctions::glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
1004 {
1005 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1006     ::glTexParameterfv(target, pname, params);
1007 #else
1008     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1009     d_ptr->f.TexParameterfv(target, pname, params);
1010 #endif
1011     Q_OPENGL_FUNCTIONS_DEBUG
1012 }
1013 
1014 inline void QOpenGLFunctions::glTexParameteri(GLenum target, GLenum pname, GLint param)
1015 {
1016 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1017     ::glTexParameteri(target, pname, param);
1018 #else
1019     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1020     d_ptr->f.TexParameteri(target, pname, param);
1021 #endif
1022     Q_OPENGL_FUNCTIONS_DEBUG
1023 }
1024 
1025 inline void QOpenGLFunctions::glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
1026 {
1027 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1028     ::glTexParameteriv(target, pname, params);
1029 #else
1030     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1031     d_ptr->f.TexParameteriv(target, pname, params);
1032 #endif
1033     Q_OPENGL_FUNCTIONS_DEBUG
1034 }
1035 
1036 inline void QOpenGLFunctions::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
1037 {
1038 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1039     ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
1040 #else
1041     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1042     d_ptr->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
1043 #endif
1044     Q_OPENGL_FUNCTIONS_DEBUG
1045 }
1046 
1047 inline void QOpenGLFunctions::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
1048 {
1049 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1050     ::glViewport(x, y, width, height);
1051 #else
1052     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1053     d_ptr->f.Viewport(x, y, width, height);
1054 #endif
1055     Q_OPENGL_FUNCTIONS_DEBUG
1056 }
1057 
1058 // GL(ES)2
1059 
1060 inline void QOpenGLFunctions::glActiveTexture(GLenum texture)
1061 {
1062 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1063     ::glActiveTexture(texture);
1064 #else
1065     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1066     d_ptr->f.ActiveTexture(texture);
1067 #endif
1068     Q_OPENGL_FUNCTIONS_DEBUG
1069 }
1070 
1071 inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader)
1072 {
1073 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1074     ::glAttachShader(program, shader);
1075 #else
1076     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1077     d_ptr->f.AttachShader(program, shader);
1078 #endif
1079     Q_OPENGL_FUNCTIONS_DEBUG
1080 }
1081 
1082 inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name)
1083 {
1084 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1085     ::glBindAttribLocation(program, index, name);
1086 #else
1087     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1088     d_ptr->f.BindAttribLocation(program, index, name);
1089 #endif
1090     Q_OPENGL_FUNCTIONS_DEBUG
1091 }
1092 
1093 inline void QOpenGLFunctions::glBindBuffer(GLenum target, GLuint buffer)
1094 {
1095 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1096     ::glBindBuffer(target, buffer);
1097 #else
1098     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1099     d_ptr->f.BindBuffer(target, buffer);
1100 #endif
1101     Q_OPENGL_FUNCTIONS_DEBUG
1102 }
1103 
1104 inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer)
1105 {
1106     if (framebuffer == 0)
1107         framebuffer = QOpenGLContext::currentContext()->defaultFramebufferObject();
1108 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1109     ::glBindFramebuffer(target, framebuffer);
1110 #else
1111     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1112     d_ptr->f.BindFramebuffer(target, framebuffer);
1113 #endif
1114     Q_OPENGL_FUNCTIONS_DEBUG
1115 }
1116 
1117 inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
1118 {
1119 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1120     ::glBindRenderbuffer(target, renderbuffer);
1121 #else
1122     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1123     d_ptr->f.BindRenderbuffer(target, renderbuffer);
1124 #endif
1125     Q_OPENGL_FUNCTIONS_DEBUG
1126 }
1127 
1128 inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
1129 {
1130 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1131     ::glBlendColor(red, green, blue, alpha);
1132 #else
1133     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1134     d_ptr->f.BlendColor(red, green, blue, alpha);
1135 #endif
1136     Q_OPENGL_FUNCTIONS_DEBUG
1137 }
1138 
1139 inline void QOpenGLFunctions::glBlendEquation(GLenum mode)
1140 {
1141 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1142     ::glBlendEquation(mode);
1143 #else
1144     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1145     d_ptr->f.BlendEquation(mode);
1146 #endif
1147     Q_OPENGL_FUNCTIONS_DEBUG
1148 }
1149 
1150 inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
1151 {
1152 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1153     ::glBlendEquationSeparate(modeRGB, modeAlpha);
1154 #else
1155     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1156     d_ptr->f.BlendEquationSeparate(modeRGB, modeAlpha);
1157 #endif
1158     Q_OPENGL_FUNCTIONS_DEBUG
1159 }
1160 
1161 inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
1162 {
1163 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1164     ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
1165 #else
1166     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1167     d_ptr->f.BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
1168 #endif
1169     Q_OPENGL_FUNCTIONS_DEBUG
1170 }
1171 
1172 inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage)
1173 {
1174 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1175     ::glBufferData(target, size, data, usage);
1176 #else
1177     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1178     d_ptr->f.BufferData(target, size, data, usage);
1179 #endif
1180     Q_OPENGL_FUNCTIONS_DEBUG
1181 }
1182 
1183 inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data)
1184 {
1185 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1186     ::glBufferSubData(target, offset, size, data);
1187 #else
1188     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1189     d_ptr->f.BufferSubData(target, offset, size, data);
1190 #endif
1191     Q_OPENGL_FUNCTIONS_DEBUG
1192 }
1193 
1194 inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target)
1195 {
1196 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1197     GLenum result = ::glCheckFramebufferStatus(target);
1198 #else
1199     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1200     GLenum result = d_ptr->f.CheckFramebufferStatus(target);
1201 #endif
1202     Q_OPENGL_FUNCTIONS_DEBUG
1203     return result;
1204 }
1205 
1206 inline void QOpenGLFunctions::glClearDepthf(GLclampf depth)
1207 {
1208 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1209     ::glClearDepthf(depth);
1210 #else
1211     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1212     d_ptr->f.ClearDepthf(depth);
1213 #endif
1214     Q_OPENGL_FUNCTIONS_DEBUG
1215 }
1216 
1217 inline void QOpenGLFunctions::glCompileShader(GLuint shader)
1218 {
1219 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1220     ::glCompileShader(shader);
1221 #else
1222     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1223     d_ptr->f.CompileShader(shader);
1224 #endif
1225     Q_OPENGL_FUNCTIONS_DEBUG
1226 }
1227 
1228 inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
1229 {
1230 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1231     ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
1232 #else
1233     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1234     d_ptr->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
1235 #endif
1236     Q_OPENGL_FUNCTIONS_DEBUG
1237 }
1238 
1239 inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
1240 {
1241 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1242     ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
1243 #else
1244     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1245     d_ptr->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
1246 #endif
1247     Q_OPENGL_FUNCTIONS_DEBUG
1248 }
1249 
1250 inline GLuint QOpenGLFunctions::glCreateProgram()
1251 {
1252 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1253     GLuint result = ::glCreateProgram();
1254 #else
1255     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1256     GLuint result = d_ptr->f.CreateProgram();
1257 #endif
1258     Q_OPENGL_FUNCTIONS_DEBUG
1259     return result;
1260 }
1261 
1262 inline GLuint QOpenGLFunctions::glCreateShader(GLenum type)
1263 {
1264 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1265     GLuint result = ::glCreateShader(type);
1266 #else
1267     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1268     GLuint result = d_ptr->f.CreateShader(type);
1269 #endif
1270     Q_OPENGL_FUNCTIONS_DEBUG
1271     return result;
1272 }
1273 
1274 inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
1275 {
1276 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1277     ::glDeleteBuffers(n, buffers);
1278 #else
1279     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1280     d_ptr->f.DeleteBuffers(n, buffers);
1281 #endif
1282     Q_OPENGL_FUNCTIONS_DEBUG
1283 }
1284 
1285 inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
1286 {
1287 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1288     ::glDeleteFramebuffers(n, framebuffers);
1289 #else
1290     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1291     d_ptr->f.DeleteFramebuffers(n, framebuffers);
1292 #endif
1293     Q_OPENGL_FUNCTIONS_DEBUG
1294 }
1295 
1296 inline void QOpenGLFunctions::glDeleteProgram(GLuint program)
1297 {
1298 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1299     ::glDeleteProgram(program);
1300 #else
1301     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1302     d_ptr->f.DeleteProgram(program);
1303 #endif
1304     Q_OPENGL_FUNCTIONS_DEBUG
1305 }
1306 
1307 inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
1308 {
1309 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1310     ::glDeleteRenderbuffers(n, renderbuffers);
1311 #else
1312     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1313     d_ptr->f.DeleteRenderbuffers(n, renderbuffers);
1314 #endif
1315     Q_OPENGL_FUNCTIONS_DEBUG
1316 }
1317 
1318 inline void QOpenGLFunctions::glDeleteShader(GLuint shader)
1319 {
1320 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1321     ::glDeleteShader(shader);
1322 #else
1323     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1324     d_ptr->f.DeleteShader(shader);
1325 #endif
1326     Q_OPENGL_FUNCTIONS_DEBUG
1327 }
1328 
1329 inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
1330 {
1331 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1332     ::glDepthRangef(zNear, zFar);
1333 #else
1334     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1335     d_ptr->f.DepthRangef(zNear, zFar);
1336 #endif
1337     Q_OPENGL_FUNCTIONS_DEBUG
1338 }
1339 
1340 inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader)
1341 {
1342 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1343     ::glDetachShader(program, shader);
1344 #else
1345     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1346     d_ptr->f.DetachShader(program, shader);
1347 #endif
1348     Q_OPENGL_FUNCTIONS_DEBUG
1349 }
1350 
1351 inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index)
1352 {
1353 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1354     ::glDisableVertexAttribArray(index);
1355 #else
1356     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1357     d_ptr->f.DisableVertexAttribArray(index);
1358 #endif
1359     Q_OPENGL_FUNCTIONS_DEBUG
1360 }
1361 
1362 inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index)
1363 {
1364 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1365     ::glEnableVertexAttribArray(index);
1366 #else
1367     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1368     d_ptr->f.EnableVertexAttribArray(index);
1369 #endif
1370     Q_OPENGL_FUNCTIONS_DEBUG
1371 }
1372 
1373 inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
1374 {
1375 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1376     ::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
1377 #else
1378     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1379     d_ptr->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
1380 #endif
1381     Q_OPENGL_FUNCTIONS_DEBUG
1382 }
1383 
1384 inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
1385 {
1386 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1387     ::glFramebufferTexture2D(target, attachment, textarget, texture, level);
1388 #else
1389     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1390     d_ptr->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
1391 #endif
1392     Q_OPENGL_FUNCTIONS_DEBUG
1393 }
1394 
1395 inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
1396 {
1397 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1398     ::glGenBuffers(n, buffers);
1399 #else
1400     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1401     d_ptr->f.GenBuffers(n, buffers);
1402 #endif
1403     Q_OPENGL_FUNCTIONS_DEBUG
1404 }
1405 
1406 inline void QOpenGLFunctions::glGenerateMipmap(GLenum target)
1407 {
1408 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1409     ::glGenerateMipmap(target);
1410 #else
1411     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1412     d_ptr->f.GenerateMipmap(target);
1413 #endif
1414     Q_OPENGL_FUNCTIONS_DEBUG
1415 }
1416 
1417 inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
1418 {
1419 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1420     ::glGenFramebuffers(n, framebuffers);
1421 #else
1422     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1423     d_ptr->f.GenFramebuffers(n, framebuffers);
1424 #endif
1425     Q_OPENGL_FUNCTIONS_DEBUG
1426 }
1427 
1428 inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
1429 {
1430 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1431     ::glGenRenderbuffers(n, renderbuffers);
1432 #else
1433     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1434     d_ptr->f.GenRenderbuffers(n, renderbuffers);
1435 #endif
1436     Q_OPENGL_FUNCTIONS_DEBUG
1437 }
1438 
1439 inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
1440 {
1441 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1442     ::glGetActiveAttrib(program, index, bufsize, length, size, type, name);
1443 #else
1444     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1445     d_ptr->f.GetActiveAttrib(program, index, bufsize, length, size, type, name);
1446 #endif
1447     Q_OPENGL_FUNCTIONS_DEBUG
1448 }
1449 
1450 inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
1451 {
1452 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1453     ::glGetActiveUniform(program, index, bufsize, length, size, type, name);
1454 #else
1455     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1456     d_ptr->f.GetActiveUniform(program, index, bufsize, length, size, type, name);
1457 #endif
1458     Q_OPENGL_FUNCTIONS_DEBUG
1459 }
1460 
1461 inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
1462 {
1463 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1464     ::glGetAttachedShaders(program, maxcount, count, shaders);
1465 #else
1466     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1467     d_ptr->f.GetAttachedShaders(program, maxcount, count, shaders);
1468 #endif
1469     Q_OPENGL_FUNCTIONS_DEBUG
1470 }
1471 
1472 inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* name)
1473 {
1474 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1475     GLint result = ::glGetAttribLocation(program, name);
1476 #else
1477     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1478     GLint result = d_ptr->f.GetAttribLocation(program, name);
1479 #endif
1480     Q_OPENGL_FUNCTIONS_DEBUG
1481     return result;
1482 }
1483 
1484 inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
1485 {
1486 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1487     ::glGetBufferParameteriv(target, pname, params);
1488 #else
1489     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1490     d_ptr->f.GetBufferParameteriv(target, pname, params);
1491 #endif
1492     Q_OPENGL_FUNCTIONS_DEBUG
1493 }
1494 
1495 inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
1496 {
1497 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1498     ::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
1499 #else
1500     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1501     d_ptr->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
1502 #endif
1503     Q_OPENGL_FUNCTIONS_DEBUG
1504 }
1505 
1506 inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params)
1507 {
1508 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1509     ::glGetProgramiv(program, pname, params);
1510 #else
1511     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1512     d_ptr->f.GetProgramiv(program, pname, params);
1513 #endif
1514     Q_OPENGL_FUNCTIONS_DEBUG
1515 }
1516 
1517 inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
1518 {
1519 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1520     ::glGetProgramInfoLog(program, bufsize, length, infolog);
1521 #else
1522     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1523     d_ptr->f.GetProgramInfoLog(program, bufsize, length, infolog);
1524 #endif
1525     Q_OPENGL_FUNCTIONS_DEBUG
1526 }
1527 
1528 inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
1529 {
1530 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1531     ::glGetRenderbufferParameteriv(target, pname, params);
1532 #else
1533     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1534     d_ptr->f.GetRenderbufferParameteriv(target, pname, params);
1535 #endif
1536     Q_OPENGL_FUNCTIONS_DEBUG
1537 }
1538 
1539 inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
1540 {
1541 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1542     ::glGetShaderiv(shader, pname, params);
1543 #else
1544     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1545     d_ptr->f.GetShaderiv(shader, pname, params);
1546 #endif
1547     Q_OPENGL_FUNCTIONS_DEBUG
1548 }
1549 
1550 inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
1551 {
1552 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1553     ::glGetShaderInfoLog(shader, bufsize, length, infolog);
1554 #else
1555     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1556     d_ptr->f.GetShaderInfoLog(shader, bufsize, length, infolog);
1557 #endif
1558     Q_OPENGL_FUNCTIONS_DEBUG
1559 }
1560 
1561 inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
1562 {
1563 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1564     ::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
1565 #else
1566     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1567     d_ptr->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
1568 #endif
1569     Q_OPENGL_FUNCTIONS_DEBUG
1570 }
1571 
1572 inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
1573 {
1574 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1575     ::glGetShaderSource(shader, bufsize, length, source);
1576 #else
1577     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1578     d_ptr->f.GetShaderSource(shader, bufsize, length, source);
1579 #endif
1580     Q_OPENGL_FUNCTIONS_DEBUG
1581 }
1582 
1583 inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params)
1584 {
1585 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1586     ::glGetUniformfv(program, location, params);
1587 #else
1588     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1589     d_ptr->f.GetUniformfv(program, location, params);
1590 #endif
1591     Q_OPENGL_FUNCTIONS_DEBUG
1592 }
1593 
1594 inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params)
1595 {
1596 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1597     ::glGetUniformiv(program, location, params);
1598 #else
1599     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1600     d_ptr->f.GetUniformiv(program, location, params);
1601 #endif
1602     Q_OPENGL_FUNCTIONS_DEBUG
1603 }
1604 
1605 inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char* name)
1606 {
1607 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1608     GLint result = ::glGetUniformLocation(program, name);
1609 #else
1610     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1611     GLint result = d_ptr->f.GetUniformLocation(program, name);
1612 #endif
1613     Q_OPENGL_FUNCTIONS_DEBUG
1614     return result;
1615 }
1616 
1617 inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
1618 {
1619 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1620     ::glGetVertexAttribfv(index, pname, params);
1621 #else
1622     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1623     d_ptr->f.GetVertexAttribfv(index, pname, params);
1624 #endif
1625     Q_OPENGL_FUNCTIONS_DEBUG
1626 }
1627 
1628 inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
1629 {
1630 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1631     ::glGetVertexAttribiv(index, pname, params);
1632 #else
1633     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1634     d_ptr->f.GetVertexAttribiv(index, pname, params);
1635 #endif
1636     Q_OPENGL_FUNCTIONS_DEBUG
1637 }
1638 
1639 inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
1640 {
1641 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1642     ::glGetVertexAttribPointerv(index, pname, pointer);
1643 #else
1644     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1645     d_ptr->f.GetVertexAttribPointerv(index, pname, pointer);
1646 #endif
1647     Q_OPENGL_FUNCTIONS_DEBUG
1648 }
1649 
1650 inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer)
1651 {
1652 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1653     GLboolean result = ::glIsBuffer(buffer);
1654 #else
1655     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1656     GLboolean result = d_ptr->f.IsBuffer(buffer);
1657 #endif
1658     Q_OPENGL_FUNCTIONS_DEBUG
1659     return result;
1660 }
1661 
1662 inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer)
1663 {
1664 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1665     GLboolean result = ::glIsFramebuffer(framebuffer);
1666 #else
1667     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1668     GLboolean result = d_ptr->f.IsFramebuffer(framebuffer);
1669 #endif
1670     Q_OPENGL_FUNCTIONS_DEBUG
1671     return result;
1672 }
1673 
1674 inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program)
1675 {
1676 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1677     GLboolean result = ::glIsProgram(program);
1678 #else
1679     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1680     GLboolean result = d_ptr->f.IsProgram(program);
1681 #endif
1682     Q_OPENGL_FUNCTIONS_DEBUG
1683     return result;
1684 }
1685 
1686 inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
1687 {
1688 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1689     GLboolean result = ::glIsRenderbuffer(renderbuffer);
1690 #else
1691     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1692     GLboolean result = d_ptr->f.IsRenderbuffer(renderbuffer);
1693 #endif
1694     Q_OPENGL_FUNCTIONS_DEBUG
1695     return result;
1696 }
1697 
1698 inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader)
1699 {
1700 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1701     GLboolean result = ::glIsShader(shader);
1702 #else
1703     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1704     GLboolean result = d_ptr->f.IsShader(shader);
1705 #endif
1706     Q_OPENGL_FUNCTIONS_DEBUG
1707     return result;
1708 }
1709 
1710 inline void QOpenGLFunctions::glLinkProgram(GLuint program)
1711 {
1712 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1713     ::glLinkProgram(program);
1714 #else
1715     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1716     d_ptr->f.LinkProgram(program);
1717 #endif
1718     Q_OPENGL_FUNCTIONS_DEBUG
1719 }
1720 
1721 inline void QOpenGLFunctions::glReleaseShaderCompiler()
1722 {
1723 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1724     ::glReleaseShaderCompiler();
1725 #else
1726     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1727     d_ptr->f.ReleaseShaderCompiler();
1728 #endif
1729     Q_OPENGL_FUNCTIONS_DEBUG
1730 }
1731 
1732 inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
1733 {
1734 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1735     ::glRenderbufferStorage(target, internalformat, width, height);
1736 #else
1737     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1738     d_ptr->f.RenderbufferStorage(target, internalformat, width, height);
1739 #endif
1740     Q_OPENGL_FUNCTIONS_DEBUG
1741 }
1742 
1743 inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
1744 {
1745 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1746     ::glSampleCoverage(value, invert);
1747 #else
1748     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1749     d_ptr->f.SampleCoverage(value, invert);
1750 #endif
1751     Q_OPENGL_FUNCTIONS_DEBUG
1752 }
1753 
1754 inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
1755 {
1756 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1757     ::glShaderBinary(n, shaders, binaryformat, binary, length);
1758 #else
1759     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1760     d_ptr->f.ShaderBinary(n, shaders, binaryformat, binary, length);
1761 #endif
1762     Q_OPENGL_FUNCTIONS_DEBUG
1763 }
1764 
1765 inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
1766 {
1767 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1768     ::glShaderSource(shader, count, string, length);
1769 #else
1770     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1771     d_ptr->f.ShaderSource(shader, count, string, length);
1772 #endif
1773     Q_OPENGL_FUNCTIONS_DEBUG
1774 }
1775 
1776 inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
1777 {
1778 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1779     ::glStencilFuncSeparate(face, func, ref, mask);
1780 #else
1781     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1782     d_ptr->f.StencilFuncSeparate(face, func, ref, mask);
1783 #endif
1784     Q_OPENGL_FUNCTIONS_DEBUG
1785 }
1786 
1787 inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
1788 {
1789 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1790     ::glStencilMaskSeparate(face, mask);
1791 #else
1792     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1793     d_ptr->f.StencilMaskSeparate(face, mask);
1794 #endif
1795     Q_OPENGL_FUNCTIONS_DEBUG
1796 }
1797 
1798 inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
1799 {
1800 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1801     ::glStencilOpSeparate(face, fail, zfail, zpass);
1802 #else
1803     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1804     d_ptr->f.StencilOpSeparate(face, fail, zfail, zpass);
1805 #endif
1806     Q_OPENGL_FUNCTIONS_DEBUG
1807 }
1808 
1809 inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x)
1810 {
1811 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1812     ::glUniform1f(location, x);
1813 #else
1814     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1815     d_ptr->f.Uniform1f(location, x);
1816 #endif
1817     Q_OPENGL_FUNCTIONS_DEBUG
1818 }
1819 
1820 inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
1821 {
1822 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1823     ::glUniform1fv(location, count, v);
1824 #else
1825     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1826     d_ptr->f.Uniform1fv(location, count, v);
1827 #endif
1828     Q_OPENGL_FUNCTIONS_DEBUG
1829 }
1830 
1831 inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x)
1832 {
1833 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1834     ::glUniform1i(location, x);
1835 #else
1836     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1837     d_ptr->f.Uniform1i(location, x);
1838 #endif
1839     Q_OPENGL_FUNCTIONS_DEBUG
1840 }
1841 
1842 inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v)
1843 {
1844 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1845     ::glUniform1iv(location, count, v);
1846 #else
1847     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1848     d_ptr->f.Uniform1iv(location, count, v);
1849 #endif
1850     Q_OPENGL_FUNCTIONS_DEBUG
1851 }
1852 
1853 inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
1854 {
1855 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1856     ::glUniform2f(location, x, y);
1857 #else
1858     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1859     d_ptr->f.Uniform2f(location, x, y);
1860 #endif
1861     Q_OPENGL_FUNCTIONS_DEBUG
1862 }
1863 
1864 inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
1865 {
1866 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1867     ::glUniform2fv(location, count, v);
1868 #else
1869     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1870     d_ptr->f.Uniform2fv(location, count, v);
1871 #endif
1872     Q_OPENGL_FUNCTIONS_DEBUG
1873 }
1874 
1875 inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
1876 {
1877 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1878     ::glUniform2i(location, x, y);
1879 #else
1880     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1881     d_ptr->f.Uniform2i(location, x, y);
1882 #endif
1883     Q_OPENGL_FUNCTIONS_DEBUG
1884 }
1885 
1886 inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v)
1887 {
1888 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1889     ::glUniform2iv(location, count, v);
1890 #else
1891     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1892     d_ptr->f.Uniform2iv(location, count, v);
1893 #endif
1894     Q_OPENGL_FUNCTIONS_DEBUG
1895 }
1896 
1897 inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
1898 {
1899 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1900     ::glUniform3f(location, x, y, z);
1901 #else
1902     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1903     d_ptr->f.Uniform3f(location, x, y, z);
1904 #endif
1905     Q_OPENGL_FUNCTIONS_DEBUG
1906 }
1907 
1908 inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
1909 {
1910 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1911     ::glUniform3fv(location, count, v);
1912 #else
1913     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1914     d_ptr->f.Uniform3fv(location, count, v);
1915 #endif
1916     Q_OPENGL_FUNCTIONS_DEBUG
1917 }
1918 
1919 inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z)
1920 {
1921 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1922     ::glUniform3i(location, x, y, z);
1923 #else
1924     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1925     d_ptr->f.Uniform3i(location, x, y, z);
1926 #endif
1927     Q_OPENGL_FUNCTIONS_DEBUG
1928 }
1929 
1930 inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v)
1931 {
1932 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1933     ::glUniform3iv(location, count, v);
1934 #else
1935     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1936     d_ptr->f.Uniform3iv(location, count, v);
1937 #endif
1938     Q_OPENGL_FUNCTIONS_DEBUG
1939 }
1940 
1941 inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1942 {
1943 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1944     ::glUniform4f(location, x, y, z, w);
1945 #else
1946     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1947     d_ptr->f.Uniform4f(location, x, y, z, w);
1948 #endif
1949     Q_OPENGL_FUNCTIONS_DEBUG
1950 }
1951 
1952 inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
1953 {
1954 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1955     ::glUniform4fv(location, count, v);
1956 #else
1957     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1958     d_ptr->f.Uniform4fv(location, count, v);
1959 #endif
1960     Q_OPENGL_FUNCTIONS_DEBUG
1961 }
1962 
1963 inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
1964 {
1965 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1966     ::glUniform4i(location, x, y, z, w);
1967 #else
1968     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1969     d_ptr->f.Uniform4i(location, x, y, z, w);
1970 #endif
1971     Q_OPENGL_FUNCTIONS_DEBUG
1972 }
1973 
1974 inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v)
1975 {
1976 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1977     ::glUniform4iv(location, count, v);
1978 #else
1979     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1980     d_ptr->f.Uniform4iv(location, count, v);
1981 #endif
1982     Q_OPENGL_FUNCTIONS_DEBUG
1983 }
1984 
1985 inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1986 {
1987 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1988     ::glUniformMatrix2fv(location, count, transpose, value);
1989 #else
1990     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1991     d_ptr->f.UniformMatrix2fv(location, count, transpose, value);
1992 #endif
1993     Q_OPENGL_FUNCTIONS_DEBUG
1994 }
1995 
1996 inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1997 {
1998 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
1999     ::glUniformMatrix3fv(location, count, transpose, value);
2000 #else
2001     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2002     d_ptr->f.UniformMatrix3fv(location, count, transpose, value);
2003 #endif
2004     Q_OPENGL_FUNCTIONS_DEBUG
2005 }
2006 
2007 inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
2008 {
2009 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2010     ::glUniformMatrix4fv(location, count, transpose, value);
2011 #else
2012     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2013     d_ptr->f.UniformMatrix4fv(location, count, transpose, value);
2014 #endif
2015     Q_OPENGL_FUNCTIONS_DEBUG
2016 }
2017 
2018 inline void QOpenGLFunctions::glUseProgram(GLuint program)
2019 {
2020 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2021     ::glUseProgram(program);
2022 #else
2023     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2024     d_ptr->f.UseProgram(program);
2025 #endif
2026     Q_OPENGL_FUNCTIONS_DEBUG
2027 }
2028 
2029 inline void QOpenGLFunctions::glValidateProgram(GLuint program)
2030 {
2031 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2032     ::glValidateProgram(program);
2033 #else
2034     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2035     d_ptr->f.ValidateProgram(program);
2036 #endif
2037     Q_OPENGL_FUNCTIONS_DEBUG
2038 }
2039 
2040 inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
2041 {
2042 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2043     ::glVertexAttrib1f(indx, x);
2044 #else
2045     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2046     d_ptr->f.VertexAttrib1f(indx, x);
2047 #endif
2048     Q_OPENGL_FUNCTIONS_DEBUG
2049 }
2050 
2051 inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values)
2052 {
2053 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2054     ::glVertexAttrib1fv(indx, values);
2055 #else
2056     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2057     d_ptr->f.VertexAttrib1fv(indx, values);
2058 #endif
2059     Q_OPENGL_FUNCTIONS_DEBUG
2060 }
2061 
2062 inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
2063 {
2064 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2065     ::glVertexAttrib2f(indx, x, y);
2066 #else
2067     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2068     d_ptr->f.VertexAttrib2f(indx, x, y);
2069 #endif
2070     Q_OPENGL_FUNCTIONS_DEBUG
2071 }
2072 
2073 inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values)
2074 {
2075 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2076     ::glVertexAttrib2fv(indx, values);
2077 #else
2078     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2079     d_ptr->f.VertexAttrib2fv(indx, values);
2080 #endif
2081     Q_OPENGL_FUNCTIONS_DEBUG
2082 }
2083 
2084 inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
2085 {
2086 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2087     ::glVertexAttrib3f(indx, x, y, z);
2088 #else
2089     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2090     d_ptr->f.VertexAttrib3f(indx, x, y, z);
2091 #endif
2092     Q_OPENGL_FUNCTIONS_DEBUG
2093 }
2094 
2095 inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values)
2096 {
2097 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2098     ::glVertexAttrib3fv(indx, values);
2099 #else
2100     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2101     d_ptr->f.VertexAttrib3fv(indx, values);
2102 #endif
2103     Q_OPENGL_FUNCTIONS_DEBUG
2104 }
2105 
2106 inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
2107 {
2108 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2109     ::glVertexAttrib4f(indx, x, y, z, w);
2110 #else
2111     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2112     d_ptr->f.VertexAttrib4f(indx, x, y, z, w);
2113 #endif
2114     Q_OPENGL_FUNCTIONS_DEBUG
2115 }
2116 
2117 inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values)
2118 {
2119 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2120     ::glVertexAttrib4fv(indx, values);
2121 #else
2122     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2123     d_ptr->f.VertexAttrib4fv(indx, values);
2124 #endif
2125     Q_OPENGL_FUNCTIONS_DEBUG
2126 }
2127 
2128 inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
2129 {
2130 #if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
2131     ::glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
2132 #else
2133     Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2134     d_ptr->f.VertexAttribPointer(indx, size, type, normalized, stride, ptr);
2135 #endif
2136     Q_OPENGL_FUNCTIONS_DEBUG
2137 }
2138 
2139 #undef QT_OPENGL_DECLARE_FUNCTIONS
2140 #undef QT_OPENGL_COUNT_FUNCTIONS
2141 #undef QT_OPENGL_DECLARE
2142 
2143 QT_END_NAMESPACE
2144 
2145 #endif // QT_NO_OPENGL
2146 
2147 #endif