1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QOPENGLFUNCTIONS_H
41#define QOPENGLFUNCTIONS_H
42
43#include <QtGui/qtguiglobal.h>
44
45#ifndef QT_NO_OPENGL
46
47#ifdef __GLEW_H__
48#if defined(Q_CC_GNU)
49#warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
50#warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h
51#endif
52#endif
53
54#include <QtGui/qopengl.h>
55#include <QtGui/qopenglcontext.h>
56
57//#define Q_ENABLE_OPENGL_FUNCTIONS_DEBUG
58
59#ifdef QT_OPENGL_ES
60typedef double GLdouble;
61#endif
62
63#ifdef Q_ENABLE_OPENGL_FUNCTIONS_DEBUG
64#include <stdio.h>
65#define Q_OPENGL_FUNCTIONS_DEBUG \
66 GLenum error = glGetError(); \
67 if (error != GL_NO_ERROR) { \
68 unsigned clamped = qMin(unsigned(error - GL_INVALID_ENUM), 4U); \
69 const char *errors[] = { "GL_INVALID_ENUM", "GL_INVALID_VALUE", "GL_INVALID_OPERATION", "Unknown" }; \
70 printf("GL error at %s:%d: %s\n", __FILE__, __LINE__, errors[clamped]); \
71 int *value = 0; \
72 *value = 0; \
73 }
74#else
75#define Q_OPENGL_FUNCTIONS_DEBUG
76#endif
77
78QT_BEGIN_NAMESPACE
79
80struct QOpenGLFunctionsPrivate;
81
82// Undefine any macros from GLEW, qopenglextensions_p.h, etc that
83// may interfere with the definition of QOpenGLFunctions.
84#undef glBindTexture
85#undef glBlendFunc
86#undef glClear
87#undef glClearColor
88#undef glClearStencil
89#undef glColorMask
90#undef glCopyTexImage2D
91#undef glCopyTexSubImage2D
92#undef glCullFace
93#undef glDeleteTextures
94#undef glDepthFunc
95#undef glDepthMask
96#undef glDisable
97#undef glDrawArrays
98#undef glDrawElements
99#undef glEnable
100#undef glFinish
101#undef glFlush
102#undef glFrontFace
103#undef glGenTextures
104#undef glGetBooleanv
105#undef glGetError
106#undef glGetFloatv
107#undef glGetIntegerv
108#undef glGetString
109#undef glGetTexParameterfv
110#undef glGetTexParameteriv
111#undef glHint
112#undef glIsEnabled
113#undef glIsTexture
114#undef glLineWidth
115#undef glPixelStorei
116#undef glPolygonOffset
117#undef glReadPixels
118#undef glScissor
119#undef glStencilFunc
120#undef glStencilMask
121#undef glStencilOp
122#undef glTexImage2D
123#undef glTexParameterf
124#undef glTexParameterfv
125#undef glTexParameteri
126#undef glTexParameteriv
127#undef glTexSubImage2D
128#undef glViewport
129
130#undef glActiveTexture
131#undef glAttachShader
132#undef glBindAttribLocation
133#undef glBindBuffer
134#undef glBindFramebuffer
135#undef glBindRenderbuffer
136#undef glBlendColor
137#undef glBlendEquation
138#undef glBlendEquationSeparate
139#undef glBlendFuncSeparate
140#undef glBufferData
141#undef glBufferSubData
142#undef glCheckFramebufferStatus
143#undef glClearDepthf
144#undef glCompileShader
145#undef glCompressedTexImage2D
146#undef glCompressedTexSubImage2D
147#undef glCreateProgram
148#undef glCreateShader
149#undef glDeleteBuffers
150#undef glDeleteFramebuffers
151#undef glDeleteProgram
152#undef glDeleteRenderbuffers
153#undef glDeleteShader
154#undef glDepthRangef
155#undef glDetachShader
156#undef glDisableVertexAttribArray
157#undef glEnableVertexAttribArray
158#undef glFramebufferRenderbuffer
159#undef glFramebufferTexture2D
160#undef glGenBuffers
161#undef glGenerateMipmap
162#undef glGenFramebuffers
163#undef glGenRenderbuffers
164#undef glGetActiveAttrib
165#undef glGetActiveUniform
166#undef glGetAttachedShaders
167#undef glGetAttribLocation
168#undef glGetBufferParameteriv
169#undef glGetFramebufferAttachmentParameteriv
170#undef glGetProgramiv
171#undef glGetProgramInfoLog
172#undef glGetRenderbufferParameteriv
173#undef glGetShaderiv
174#undef glGetShaderInfoLog
175#undef glGetShaderPrecisionFormat
176#undef glGetShaderSource
177#undef glGetUniformfv
178#undef glGetUniformiv
179#undef glGetUniformLocation
180#undef glGetVertexAttribfv
181#undef glGetVertexAttribiv
182#undef glGetVertexAttribPointerv
183#undef glIsBuffer
184#undef glIsFramebuffer
185#undef glIsProgram
186#undef glIsRenderbuffer
187#undef glIsShader
188#undef glLinkProgram
189#undef glReleaseShaderCompiler
190#undef glRenderbufferStorage
191#undef glSampleCoverage
192#undef glShaderBinary
193#undef glShaderSource
194#undef glStencilFuncSeparate
195#undef glStencilMaskSeparate
196#undef glStencilOpSeparate
197#undef glUniform1f
198#undef glUniform1fv
199#undef glUniform1i
200#undef glUniform1iv
201#undef glUniform2f
202#undef glUniform2fv
203#undef glUniform2i
204#undef glUniform2iv
205#undef glUniform3f
206#undef glUniform3fv
207#undef glUniform3i
208#undef glUniform3iv
209#undef glUniform4f
210#undef glUniform4fv
211#undef glUniform4i
212#undef glUniform4iv
213#undef glUniformMatrix2fv
214#undef glUniformMatrix3fv
215#undef glUniformMatrix4fv
216#undef glUseProgram
217#undef glValidateProgram
218#undef glVertexAttrib1f
219#undef glVertexAttrib1fv
220#undef glVertexAttrib2f
221#undef glVertexAttrib2fv
222#undef glVertexAttrib3f
223#undef glVertexAttrib3fv
224#undef glVertexAttrib4f
225#undef glVertexAttrib4fv
226#undef glVertexAttribPointer
227
228#undef glTexLevelParameteriv
229
230#if defined(Q_CLANG_QDOC)
231#undef GLbitfield
232typedef unsigned int GLbitfield;
233#undef GLchar
234typedef char GLchar;
235#endif
236
237class Q_GUI_EXPORT QOpenGLFunctions
238{
239public:
240 QOpenGLFunctions();
241 explicit QOpenGLFunctions(QOpenGLContext *context);
242 ~QOpenGLFunctions() {}
243
244 enum OpenGLFeature
245 {
246 Multitexture = 0x0001,
247 Shaders = 0x0002,
248 Buffers = 0x0004,
249 Framebuffers = 0x0008,
250 BlendColor = 0x0010,
251 BlendEquation = 0x0020,
252 BlendEquationSeparate = 0x0040,
253 BlendFuncSeparate = 0x0080,
254 BlendSubtract = 0x0100,
255 CompressedTextures = 0x0200,
256 Multisample = 0x0400,
257 StencilSeparate = 0x0800,
258 NPOTTextures = 0x1000,
259 NPOTTextureRepeat = 0x2000,
260 FixedFunctionPipeline = 0x4000,
261 TextureRGFormats = 0x8000,
262 MultipleRenderTargets = 0x10000,
263 BlendEquationAdvanced = 0x20000,
264 };
265 Q_DECLARE_FLAGS(OpenGLFeatures, OpenGLFeature)
266
267 QOpenGLFunctions::OpenGLFeatures openGLFeatures() const;
268 bool hasOpenGLFeature(QOpenGLFunctions::OpenGLFeature feature) const;
269
270 void initializeOpenGLFunctions();
271
272#if QT_DEPRECATED_SINCE(5, 0)
273 QT_DEPRECATED void initializeGLFunctions() { initializeOpenGLFunctions(); }
274#endif
275
276 // GLES2 + OpenGL1 common subset
277 void glBindTexture(GLenum target, GLuint texture);
278 void glBlendFunc(GLenum sfactor, GLenum dfactor);
279 void glClear(GLbitfield mask);
280 void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
281 void glClearStencil(GLint s);
282 void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
283 void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
284 void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
285 void glCullFace(GLenum mode);
286 void glDeleteTextures(GLsizei n, const GLuint* textures);
287 void glDepthFunc(GLenum func);
288 void glDepthMask(GLboolean flag);
289 void glDisable(GLenum cap);
290 void glDrawArrays(GLenum mode, GLint first, GLsizei count);
291 void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
292 void glEnable(GLenum cap);
293 void glFinish();
294 void glFlush();
295 void glFrontFace(GLenum mode);
296 void glGenTextures(GLsizei n, GLuint* textures);
297 void glGetBooleanv(GLenum pname, GLboolean* params);
298 GLenum glGetError();
299 void glGetFloatv(GLenum pname, GLfloat* params);
300 void glGetIntegerv(GLenum pname, GLint* params);
301 const GLubyte *glGetString(GLenum name);
302 void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
303 void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
304 void glHint(GLenum target, GLenum mode);
305 GLboolean glIsEnabled(GLenum cap);
306 GLboolean glIsTexture(GLuint texture);
307 void glLineWidth(GLfloat width);
308 void glPixelStorei(GLenum pname, GLint param);
309 void glPolygonOffset(GLfloat factor, GLfloat units);
310 void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
311 void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
312 void glStencilFunc(GLenum func, GLint ref, GLuint mask);
313 void glStencilMask(GLuint mask);
314 void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
315 void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
316 void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
317 void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
318 void glTexParameteri(GLenum target, GLenum pname, GLint param);
319 void glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
320 void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
321 void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
322
323 // GL(ES)2
324 void glActiveTexture(GLenum texture);
325 void glAttachShader(GLuint program, GLuint shader);
326 void glBindAttribLocation(GLuint program, GLuint index, const char* name);
327 void glBindBuffer(GLenum target, GLuint buffer);
328 void glBindFramebuffer(GLenum target, GLuint framebuffer);
329 void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
330 void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
331 void glBlendEquation(GLenum mode);
332 void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
333 void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
334 void glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage);
335 void glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data);
336 GLenum glCheckFramebufferStatus(GLenum target);
337 void glClearDepthf(GLclampf depth);
338 void glCompileShader(GLuint shader);
339 void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
340 void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
341 GLuint glCreateProgram();
342 GLuint glCreateShader(GLenum type);
343 void glDeleteBuffers(GLsizei n, const GLuint* buffers);
344 void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
345 void glDeleteProgram(GLuint program);
346 void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
347 void glDeleteShader(GLuint shader);
348 void glDepthRangef(GLclampf zNear, GLclampf zFar);
349 void glDetachShader(GLuint program, GLuint shader);
350 void glDisableVertexAttribArray(GLuint index);
351 void glEnableVertexAttribArray(GLuint index);
352 void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
353 void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
354 void glGenBuffers(GLsizei n, GLuint* buffers);
355 void glGenerateMipmap(GLenum target);
356 void glGenFramebuffers(GLsizei n, GLuint* framebuffers);
357 void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers);
358 void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
359 void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
360 void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
361 GLint glGetAttribLocation(GLuint program, const char* name);
362 void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
363 void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
364 void glGetProgramiv(GLuint program, GLenum pname, GLint* params);
365 void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
366 void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
367 void glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
368 void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
369 void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
370 void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
371 void glGetUniformfv(GLuint program, GLint location, GLfloat* params);
372 void glGetUniformiv(GLuint program, GLint location, GLint* params);
373 GLint glGetUniformLocation(GLuint program, const char* name);
374 void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
375 void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
376 void glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer);
377 GLboolean glIsBuffer(GLuint buffer);
378 GLboolean glIsFramebuffer(GLuint framebuffer);
379 GLboolean glIsProgram(GLuint program);
380 GLboolean glIsRenderbuffer(GLuint renderbuffer);
381 GLboolean glIsShader(GLuint shader);
382 void glLinkProgram(GLuint program);
383 void glReleaseShaderCompiler();
384 void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
385 void glSampleCoverage(GLclampf value, GLboolean invert);
386 void glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
387 void glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length);
388 void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
389 void glStencilMaskSeparate(GLenum face, GLuint mask);
390 void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
391 void glUniform1f(GLint location, GLfloat x);
392 void glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
393 void glUniform1i(GLint location, GLint x);
394 void glUniform1iv(GLint location, GLsizei count, const GLint* v);
395 void glUniform2f(GLint location, GLfloat x, GLfloat y);
396 void glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
397 void glUniform2i(GLint location, GLint x, GLint y);
398 void glUniform2iv(GLint location, GLsizei count, const GLint* v);
399 void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
400 void glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
401 void glUniform3i(GLint location, GLint x, GLint y, GLint z);
402 void glUniform3iv(GLint location, GLsizei count, const GLint* v);
403 void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
404 void glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
405 void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
406 void glUniform4iv(GLint location, GLsizei count, const GLint* v);
407 void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
408 void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
409 void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
410 void glUseProgram(GLuint program);
411 void glValidateProgram(GLuint program);
412 void glVertexAttrib1f(GLuint indx, GLfloat x);
413 void glVertexAttrib1fv(GLuint indx, const GLfloat* values);
414 void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
415 void glVertexAttrib2fv(GLuint indx, const GLfloat* values);
416 void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
417 void glVertexAttrib3fv(GLuint indx, const GLfloat* values);
418 void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
419 void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
420 void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
421
422protected:
423 QOpenGLFunctionsPrivate *d_ptr;
424 static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != nullptr; }
425};
426
427Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLFunctions::OpenGLFeatures)
428
429#define QT_OPENGL_DECLARE_FUNCTIONS(ret, name, args) \
430 ret (QOPENGLF_APIENTRYP name)args;
431#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
432
433#define QT_OPENGL_DECLARE(FUNCTIONS) \
434public: \
435 struct Functions { \
436 FUNCTIONS(QT_OPENGL_DECLARE_FUNCTIONS) \
437 }; \
438 union { \
439 QFunctionPointer functions[FUNCTIONS(QT_OPENGL_COUNT_FUNCTIONS)]; \
440 Functions f; \
441 }; \
442private: \
443 void init(QOpenGLContext *context);
444
445struct QOpenGLFunctionsPrivate
446{
447 QOpenGLFunctionsPrivate(QOpenGLContext *ctx);
448
449#define QT_OPENGL_FUNCTIONS(F) \
450 F(void, BindTexture, (GLenum target, GLuint texture)) \
451 F(void, BlendFunc, (GLenum sfactor, GLenum dfactor)) \
452 F(void, Clear, (GLbitfield mask)) \
453 F(void, ClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \
454 F(void, ClearDepthf, (GLclampf depth)) \
455 F(void, ClearStencil, (GLint s)) \
456 F(void, ColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) \
457 F(void, CopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) \
458 F(void, CopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \
459 F(void, CullFace, (GLenum mode)) \
460 F(void, DeleteTextures, (GLsizei n, const GLuint* textures)) \
461 F(void, DepthFunc, (GLenum func)) \
462 F(void, DepthMask, (GLboolean flag)) \
463 F(void, DepthRangef, (GLclampf nearVal, GLclampf farVal)) \
464 F(void, Disable, (GLenum cap)) \
465 F(void, DrawArrays, (GLenum mode, GLint first, GLsizei count)) \
466 F(void, DrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)) \
467 F(void, Enable, (GLenum cap)) \
468 F(void, Finish, ()) \
469 F(void, Flush, ()) \
470 F(void, FrontFace, (GLenum mode)) \
471 F(void, GenTextures, (GLsizei n, GLuint* textures)) \
472 F(void, GetBooleanv, (GLenum pname, GLboolean* params)) \
473 F(GLenum, GetError, ()) \
474 F(void, GetFloatv, (GLenum pname, GLfloat* params)) \
475 F(void, GetIntegerv, (GLenum pname, GLint* params)) \
476 F(const GLubyte *, GetString, (GLenum name)) \
477 F(void, GetTexParameterfv, (GLenum target, GLenum pname, GLfloat* params)) \
478 F(void, GetTexParameteriv, (GLenum target, GLenum pname, GLint* params)) \
479 F(void, Hint, (GLenum target, GLenum mode)) \
480 F(GLboolean, IsEnabled, (GLenum cap)) \
481 F(GLboolean, IsTexture, (GLuint texture)) \
482 F(void, LineWidth, (GLfloat width)) \
483 F(void, PixelStorei, (GLenum pname, GLint param)) \
484 F(void, PolygonOffset, (GLfloat factor, GLfloat units)) \
485 F(void, ReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)) \
486 F(void, Scissor, (GLint x, GLint y, GLsizei width, GLsizei height)) \
487 F(void, StencilFunc, (GLenum func, GLint ref, GLuint mask)) \
488 F(void, StencilMask, (GLuint mask)) \
489 F(void, StencilOp, (GLenum fail, GLenum zfail, GLenum zpass)) \
490 F(void, TexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)) \
491 F(void, TexParameterf, (GLenum target, GLenum pname, GLfloat param)) \
492 F(void, TexParameterfv, (GLenum target, GLenum pname, const GLfloat* params)) \
493 F(void, TexParameteri, (GLenum target, GLenum pname, GLint param)) \
494 F(void, TexParameteriv, (GLenum target, GLenum pname, const GLint* params)) \
495 F(void, TexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)) \
496 F(void, Viewport, (GLint x, GLint y, GLsizei width, GLsizei height)) \
497 F(void, ActiveTexture, (GLenum texture)) \
498 F(void, AttachShader, (GLuint program, GLuint shader)) \
499 F(void, BindAttribLocation, (GLuint program, GLuint index, const char* name)) \
500 F(void, BindBuffer, (GLenum target, GLuint buffer)) \
501 F(void, BindFramebuffer, (GLenum target, GLuint framebuffer)) \
502 F(void, BindRenderbuffer, (GLenum target, GLuint renderbuffer)) \
503 F(void, BlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \
504 F(void, BlendEquation, (GLenum mode)) \
505 F(void, BlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha)) \
506 F(void, BlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)) \
507 F(void, BufferData, (GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage)) \
508 F(void, BufferSubData, (GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data)) \
509 F(GLenum, CheckFramebufferStatus, (GLenum target)) \
510 F(void, CompileShader, (GLuint shader)) \
511 F(void, CompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)) \
512 F(void, CompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)) \
513 F(GLuint, CreateProgram, ()) \
514 F(GLuint, CreateShader, (GLenum type)) \
515 F(void, DeleteBuffers, (GLsizei n, const GLuint* buffers)) \
516 F(void, DeleteFramebuffers, (GLsizei n, const GLuint* framebuffers)) \
517 F(void, DeleteProgram, (GLuint program)) \
518 F(void, DeleteRenderbuffers, (GLsizei n, const GLuint* renderbuffers)) \
519 F(void, DeleteShader, (GLuint shader)) \
520 F(void, DetachShader, (GLuint program, GLuint shader)) \
521 F(void, DisableVertexAttribArray, (GLuint index)) \
522 F(void, EnableVertexAttribArray, (GLuint index)) \
523 F(void, FramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) \
524 F(void, FramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) \
525 F(void, GenBuffers, (GLsizei n, GLuint* buffers)) \
526 F(void, GenerateMipmap, (GLenum target)) \
527 F(void, GenFramebuffers, (GLsizei n, GLuint* framebuffers)) \
528 F(void, GenRenderbuffers, (GLsizei n, GLuint* renderbuffers)) \
529 F(void, GetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)) \
530 F(void, GetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)) \
531 F(void, GetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)) \
532 F(GLint, GetAttribLocation, (GLuint program, const char* name)) \
533 F(void, GetBufferParameteriv, (GLenum target, GLenum pname, GLint* params)) \
534 F(void, GetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint* params)) \
535 F(void, GetProgramiv, (GLuint program, GLenum pname, GLint* params)) \
536 F(void, GetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)) \
537 F(void, GetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint* params)) \
538 F(void, GetShaderiv, (GLuint shader, GLenum pname, GLint* params)) \
539 F(void, GetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)) \
540 F(void, GetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)) \
541 F(void, GetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, char* source)) \
542 F(void, GetUniformfv, (GLuint program, GLint location, GLfloat* params)) \
543 F(void, GetUniformiv, (GLuint program, GLint location, GLint* params)) \
544 F(GLint, GetUniformLocation, (GLuint program, const char* name)) \
545 F(void, GetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params)) \
546 F(void, GetVertexAttribiv, (GLuint index, GLenum pname, GLint* params)) \
547 F(void, GetVertexAttribPointerv, (GLuint index, GLenum pname, void** pointer)) \
548 F(GLboolean, IsBuffer, (GLuint buffer)) \
549 F(GLboolean, IsFramebuffer, (GLuint framebuffer)) \
550 F(GLboolean, IsProgram, (GLuint program)) \
551 F(GLboolean, IsRenderbuffer, (GLuint renderbuffer)) \
552 F(GLboolean, IsShader, (GLuint shader)) \
553 F(void, LinkProgram, (GLuint program)) \
554 F(void, ReleaseShaderCompiler, ()) \
555 F(void, RenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)) \
556 F(void, SampleCoverage, (GLclampf value, GLboolean invert)) \
557 F(void, ShaderBinary, (GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)) \
558 F(void, ShaderSource, (GLuint shader, GLsizei count, const char** string, const GLint* length)) \
559 F(void, StencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask)) \
560 F(void, StencilMaskSeparate, (GLenum face, GLuint mask)) \
561 F(void, StencilOpSeparate, (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)) \
562 F(void, Uniform1f, (GLint location, GLfloat x)) \
563 F(void, Uniform1fv, (GLint location, GLsizei count, const GLfloat* v)) \
564 F(void, Uniform1i, (GLint location, GLint x)) \
565 F(void, Uniform1iv, (GLint location, GLsizei count, const GLint* v)) \
566 F(void, Uniform2f, (GLint location, GLfloat x, GLfloat y)) \
567 F(void, Uniform2fv, (GLint location, GLsizei count, const GLfloat* v)) \
568 F(void, Uniform2i, (GLint location, GLint x, GLint y)) \
569 F(void, Uniform2iv, (GLint location, GLsizei count, const GLint* v)) \
570 F(void, Uniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z)) \
571 F(void, Uniform3fv, (GLint location, GLsizei count, const GLfloat* v)) \
572 F(void, Uniform3i, (GLint location, GLint x, GLint y, GLint z)) \
573 F(void, Uniform3iv, (GLint location, GLsizei count, const GLint* v)) \
574 F(void, Uniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
575 F(void, Uniform4fv, (GLint location, GLsizei count, const GLfloat* v)) \
576 F(void, Uniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w)) \
577 F(void, Uniform4iv, (GLint location, GLsizei count, const GLint* v)) \
578 F(void, UniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
579 F(void, UniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
580 F(void, UniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
581 F(void, UseProgram, (GLuint program)) \
582 F(void, ValidateProgram, (GLuint program)) \
583 F(void, VertexAttrib1f, (GLuint indx, GLfloat x)) \
584 F(void, VertexAttrib1fv, (GLuint indx, const GLfloat* values)) \
585 F(void, VertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y)) \
586 F(void, VertexAttrib2fv, (GLuint indx, const GLfloat* values)) \
587 F(void, VertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z)) \
588 F(void, VertexAttrib3fv, (GLuint indx, const GLfloat* values)) \
589 F(void, VertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
590 F(void, VertexAttrib4fv, (GLuint indx, const GLfloat* values)) \
591 F(void, VertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)) \
592 F(void, ClearDepth, (GLdouble depth)) \
593 F(void, DepthRange, (GLdouble zNear, GLdouble zFar)) \
594
595 QT_OPENGL_DECLARE(QT_OPENGL_FUNCTIONS)
596};
597
598// GLES2 + OpenGL1 common subset
599
600inline void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture)
601{
602#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
603 ::glBindTexture(target, texture);
604#else
605 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
606 d_ptr->f.BindTexture(target, texture);
607#endif
608 Q_OPENGL_FUNCTIONS_DEBUG
609}
610
611inline void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor)
612{
613#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
614 ::glBlendFunc(sfactor, dfactor);
615#else
616 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
617 d_ptr->f.BlendFunc(sfactor, dfactor);
618#endif
619 Q_OPENGL_FUNCTIONS_DEBUG
620}
621
622inline void QOpenGLFunctions::glClear(GLbitfield mask)
623{
624#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
625 ::glClear(mask);
626#else
627 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
628 d_ptr->f.Clear(mask);
629#endif
630 Q_OPENGL_FUNCTIONS_DEBUG
631}
632
633inline void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
634{
635#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
636 ::glClearColor(red, green, blue, alpha);
637#else
638 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
639 d_ptr->f.ClearColor(red, green, blue, alpha);
640#endif
641 Q_OPENGL_FUNCTIONS_DEBUG
642}
643
644inline void QOpenGLFunctions::glClearStencil(GLint s)
645{
646#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
647 ::glClearStencil(s);
648#else
649 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
650 d_ptr->f.ClearStencil(s);
651#endif
652 Q_OPENGL_FUNCTIONS_DEBUG
653}
654
655inline void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
656{
657#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
658 ::glColorMask(red, green, blue, alpha);
659#else
660 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
661 d_ptr->f.ColorMask(red, green, blue, alpha);
662#endif
663 Q_OPENGL_FUNCTIONS_DEBUG
664}
665
666inline void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
667{
668#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
669 ::glCopyTexImage2D(target, level, internalformat, x, y, width,height, border);
670#else
671 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
672 d_ptr->f.CopyTexImage2D(target, level, internalformat, x, y, width,height, border);
673#endif
674 Q_OPENGL_FUNCTIONS_DEBUG
675}
676
677inline void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
678{
679#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
680 ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
681#else
682 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
683 d_ptr->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
684#endif
685 Q_OPENGL_FUNCTIONS_DEBUG
686}
687
688inline void QOpenGLFunctions::glCullFace(GLenum mode)
689{
690#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
691 ::glCullFace(mode);
692#else
693 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
694 d_ptr->f.CullFace(mode);
695#endif
696 Q_OPENGL_FUNCTIONS_DEBUG
697}
698
699inline void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures)
700{
701#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
702 ::glDeleteTextures(n, textures);
703#else
704 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
705 d_ptr->f.DeleteTextures(n, textures);
706#endif
707 Q_OPENGL_FUNCTIONS_DEBUG
708}
709
710inline void QOpenGLFunctions::glDepthFunc(GLenum func)
711{
712#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
713 ::glDepthFunc(func);
714#else
715 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
716 d_ptr->f.DepthFunc(func);
717#endif
718 Q_OPENGL_FUNCTIONS_DEBUG
719}
720
721inline void QOpenGLFunctions::glDepthMask(GLboolean flag)
722{
723#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
724 ::glDepthMask(flag);
725#else
726 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
727 d_ptr->f.DepthMask(flag);
728#endif
729 Q_OPENGL_FUNCTIONS_DEBUG
730}
731
732inline void QOpenGLFunctions::glDisable(GLenum cap)
733{
734#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
735 ::glDisable(cap);
736#else
737 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
738 d_ptr->f.Disable(cap);
739#endif
740 Q_OPENGL_FUNCTIONS_DEBUG
741}
742
743inline void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count)
744{
745#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
746 ::glDrawArrays(mode, first, count);
747#else
748 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
749 d_ptr->f.DrawArrays(mode, first, count);
750#endif
751 Q_OPENGL_FUNCTIONS_DEBUG
752}
753
754inline void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
755{
756#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
757 ::glDrawElements(mode, count, type, indices);
758#else
759 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
760 d_ptr->f.DrawElements(mode, count, type, indices);
761#endif
762 Q_OPENGL_FUNCTIONS_DEBUG
763}
764
765inline void QOpenGLFunctions::glEnable(GLenum cap)
766{
767#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
768 ::glEnable(cap);
769#else
770 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
771 d_ptr->f.Enable(cap);
772#endif
773 Q_OPENGL_FUNCTIONS_DEBUG
774}
775
776inline void QOpenGLFunctions::glFinish()
777{
778#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
779 ::glFinish();
780#else
781 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
782 d_ptr->f.Finish();
783#endif
784 Q_OPENGL_FUNCTIONS_DEBUG
785}
786
787inline void QOpenGLFunctions::glFlush()
788{
789#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
790 ::glFlush();
791#else
792 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
793 d_ptr->f.Flush();
794#endif
795 Q_OPENGL_FUNCTIONS_DEBUG
796}
797
798inline void QOpenGLFunctions::glFrontFace(GLenum mode)
799{
800#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
801 ::glFrontFace(mode);
802#else
803 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
804 d_ptr->f.FrontFace(mode);
805#endif
806 Q_OPENGL_FUNCTIONS_DEBUG
807}
808
809inline void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures)
810{
811#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
812 ::glGenTextures(n, textures);
813#else
814 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
815 d_ptr->f.GenTextures(n, textures);
816#endif
817 Q_OPENGL_FUNCTIONS_DEBUG
818}
819
820inline void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params)
821{
822#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
823 ::glGetBooleanv(pname, params);
824#else
825 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
826 d_ptr->f.GetBooleanv(pname, params);
827#endif
828 Q_OPENGL_FUNCTIONS_DEBUG
829}
830
831inline GLenum QOpenGLFunctions::glGetError()
832{
833#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
834 GLenum result = ::glGetError();
835#else
836 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
837 GLenum result = d_ptr->f.GetError();
838#endif
839 return result;
840}
841
842inline void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params)
843{
844#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
845 ::glGetFloatv(pname, params);
846#else
847 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
848 d_ptr->f.GetFloatv(pname, params);
849#endif
850 Q_OPENGL_FUNCTIONS_DEBUG
851}
852
853inline void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params)
854{
855#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
856 ::glGetIntegerv(pname, params);
857#else
858 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
859 d_ptr->f.GetIntegerv(pname, params);
860#endif
861 Q_OPENGL_FUNCTIONS_DEBUG
862}
863
864inline const GLubyte *QOpenGLFunctions::glGetString(GLenum name)
865{
866#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
867 const GLubyte *result = ::glGetString(name);
868#else
869 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
870 const GLubyte *result = d_ptr->f.GetString(name);
871#endif
872 Q_OPENGL_FUNCTIONS_DEBUG
873 return result;
874}
875
876inline void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
877{
878#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
879 ::glGetTexParameterfv(target, pname, params);
880#else
881 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
882 d_ptr->f.GetTexParameterfv(target, pname, params);
883#endif
884 Q_OPENGL_FUNCTIONS_DEBUG
885}
886
887inline void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
888{
889#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
890 ::glGetTexParameteriv(target, pname, params);
891#else
892 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
893 d_ptr->f.GetTexParameteriv(target, pname, params);
894#endif
895 Q_OPENGL_FUNCTIONS_DEBUG
896}
897
898inline void QOpenGLFunctions::glHint(GLenum target, GLenum mode)
899{
900#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
901 ::glHint(target, mode);
902#else
903 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
904 d_ptr->f.Hint(target, mode);
905#endif
906 Q_OPENGL_FUNCTIONS_DEBUG
907}
908
909inline GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap)
910{
911#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
912 GLboolean result = ::glIsEnabled(cap);
913#else
914 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
915 GLboolean result = d_ptr->f.IsEnabled(cap);
916#endif
917 Q_OPENGL_FUNCTIONS_DEBUG
918 return result;
919}
920
921inline GLboolean QOpenGLFunctions::glIsTexture(GLuint texture)
922{
923#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
924 GLboolean result = ::glIsTexture(texture);
925#else
926 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
927 GLboolean result = d_ptr->f.IsTexture(texture);
928#endif
929 Q_OPENGL_FUNCTIONS_DEBUG
930 return result;
931}
932
933inline void QOpenGLFunctions::glLineWidth(GLfloat width)
934{
935#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
936 ::glLineWidth(width);
937#else
938 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
939 d_ptr->f.LineWidth(width);
940#endif
941 Q_OPENGL_FUNCTIONS_DEBUG
942}
943
944inline void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param)
945{
946#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
947 ::glPixelStorei(pname, param);
948#else
949 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
950 d_ptr->f.PixelStorei(pname, param);
951#endif
952 Q_OPENGL_FUNCTIONS_DEBUG
953}
954
955inline void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units)
956{
957#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
958 ::glPolygonOffset(factor, units);
959#else
960 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
961 d_ptr->f.PolygonOffset(factor, units);
962#endif
963 Q_OPENGL_FUNCTIONS_DEBUG
964}
965
966inline void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
967{
968#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
969 ::glReadPixels(x, y, width, height, format, type, pixels);
970#else
971 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
972 d_ptr->f.ReadPixels(x, y, width, height, format, type, pixels);
973#endif
974 Q_OPENGL_FUNCTIONS_DEBUG
975}
976
977inline void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
978{
979#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
980 ::glScissor(x, y, width, height);
981#else
982 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
983 d_ptr->f.Scissor(x, y, width, height);
984#endif
985 Q_OPENGL_FUNCTIONS_DEBUG
986}
987
988inline void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask)
989{
990#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
991 ::glStencilFunc(func, ref, mask);
992#else
993 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
994 d_ptr->f.StencilFunc(func, ref, mask);
995#endif
996 Q_OPENGL_FUNCTIONS_DEBUG
997}
998
999inline void QOpenGLFunctions::glStencilMask(GLuint mask)
1000{
1001#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1002 ::glStencilMask(mask);
1003#else
1004 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1005 d_ptr->f.StencilMask(mask);
1006#endif
1007 Q_OPENGL_FUNCTIONS_DEBUG
1008}
1009
1010inline void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
1011{
1012#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1013 ::glStencilOp(fail, zfail, zpass);
1014#else
1015 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1016 d_ptr->f.StencilOp(fail, zfail, zpass);
1017#endif
1018 Q_OPENGL_FUNCTIONS_DEBUG
1019}
1020
1021inline void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
1022{
1023#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1024 ::glTexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
1025#else
1026 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1027 d_ptr->f.TexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
1028#endif
1029 Q_OPENGL_FUNCTIONS_DEBUG
1030}
1031
1032inline void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
1033{
1034#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1035 ::glTexParameterf(target, pname, param);
1036#else
1037 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1038 d_ptr->f.TexParameterf(target, pname, param);
1039#endif
1040 Q_OPENGL_FUNCTIONS_DEBUG
1041}
1042
1043inline void QOpenGLFunctions::glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
1044{
1045#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1046 ::glTexParameterfv(target, pname, params);
1047#else
1048 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1049 d_ptr->f.TexParameterfv(target, pname, params);
1050#endif
1051 Q_OPENGL_FUNCTIONS_DEBUG
1052}
1053
1054inline void QOpenGLFunctions::glTexParameteri(GLenum target, GLenum pname, GLint param)
1055{
1056#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1057 ::glTexParameteri(target, pname, param);
1058#else
1059 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1060 d_ptr->f.TexParameteri(target, pname, param);
1061#endif
1062 Q_OPENGL_FUNCTIONS_DEBUG
1063}
1064
1065inline void QOpenGLFunctions::glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
1066{
1067#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1068 ::glTexParameteriv(target, pname, params);
1069#else
1070 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1071 d_ptr->f.TexParameteriv(target, pname, params);
1072#endif
1073 Q_OPENGL_FUNCTIONS_DEBUG
1074}
1075
1076inline void QOpenGLFunctions::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
1077{
1078#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1079 ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
1080#else
1081 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1082 d_ptr->f.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
1083#endif
1084 Q_OPENGL_FUNCTIONS_DEBUG
1085}
1086
1087inline void QOpenGLFunctions::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
1088{
1089#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1090 ::glViewport(x, y, width, height);
1091#else
1092 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1093 d_ptr->f.Viewport(x, y, width, height);
1094#endif
1095 Q_OPENGL_FUNCTIONS_DEBUG
1096}
1097
1098// GL(ES)2
1099
1100inline void QOpenGLFunctions::glActiveTexture(GLenum texture)
1101{
1102#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1103 ::glActiveTexture(texture);
1104#else
1105 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1106 d_ptr->f.ActiveTexture(texture);
1107#endif
1108 Q_OPENGL_FUNCTIONS_DEBUG
1109}
1110
1111inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader)
1112{
1113#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1114 ::glAttachShader(program, shader);
1115#else
1116 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1117 d_ptr->f.AttachShader(program, shader);
1118#endif
1119 Q_OPENGL_FUNCTIONS_DEBUG
1120}
1121
1122inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name)
1123{
1124#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1125 ::glBindAttribLocation(program, index, name);
1126#else
1127 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1128 d_ptr->f.BindAttribLocation(program, index, name);
1129#endif
1130 Q_OPENGL_FUNCTIONS_DEBUG
1131}
1132
1133inline void QOpenGLFunctions::glBindBuffer(GLenum target, GLuint buffer)
1134{
1135#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1136 ::glBindBuffer(target, buffer);
1137#else
1138 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1139 d_ptr->f.BindBuffer(target, buffer);
1140#endif
1141 Q_OPENGL_FUNCTIONS_DEBUG
1142}
1143
1144inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer)
1145{
1146 if (framebuffer == 0)
1147 framebuffer = QOpenGLContext::currentContext()->defaultFramebufferObject();
1148#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1149 ::glBindFramebuffer(target, framebuffer);
1150#else
1151 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1152 d_ptr->f.BindFramebuffer(target, framebuffer);
1153#endif
1154 Q_OPENGL_FUNCTIONS_DEBUG
1155}
1156
1157inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
1158{
1159#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1160 ::glBindRenderbuffer(target, renderbuffer);
1161#else
1162 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1163 d_ptr->f.BindRenderbuffer(target, renderbuffer);
1164#endif
1165 Q_OPENGL_FUNCTIONS_DEBUG
1166}
1167
1168inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
1169{
1170#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1171 ::glBlendColor(red, green, blue, alpha);
1172#else
1173 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1174 d_ptr->f.BlendColor(red, green, blue, alpha);
1175#endif
1176 Q_OPENGL_FUNCTIONS_DEBUG
1177}
1178
1179inline void QOpenGLFunctions::glBlendEquation(GLenum mode)
1180{
1181#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1182 ::glBlendEquation(mode);
1183#else
1184 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1185 d_ptr->f.BlendEquation(mode);
1186#endif
1187 Q_OPENGL_FUNCTIONS_DEBUG
1188}
1189
1190inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
1191{
1192#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1193 ::glBlendEquationSeparate(modeRGB, modeAlpha);
1194#else
1195 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1196 d_ptr->f.BlendEquationSeparate(modeRGB, modeAlpha);
1197#endif
1198 Q_OPENGL_FUNCTIONS_DEBUG
1199}
1200
1201inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
1202{
1203#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1204 ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
1205#else
1206 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1207 d_ptr->f.BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
1208#endif
1209 Q_OPENGL_FUNCTIONS_DEBUG
1210}
1211
1212inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage)
1213{
1214#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1215 ::glBufferData(target, size, data, usage);
1216#else
1217 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1218 d_ptr->f.BufferData(target, size, data, usage);
1219#endif
1220 Q_OPENGL_FUNCTIONS_DEBUG
1221}
1222
1223inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data)
1224{
1225#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1226 ::glBufferSubData(target, offset, size, data);
1227#else
1228 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1229 d_ptr->f.BufferSubData(target, offset, size, data);
1230#endif
1231 Q_OPENGL_FUNCTIONS_DEBUG
1232}
1233
1234inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target)
1235{
1236#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1237 GLenum result = ::glCheckFramebufferStatus(target);
1238#else
1239 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1240 GLenum result = d_ptr->f.CheckFramebufferStatus(target);
1241#endif
1242 Q_OPENGL_FUNCTIONS_DEBUG
1243 return result;
1244}
1245
1246inline void QOpenGLFunctions::glClearDepthf(GLclampf depth)
1247{
1248#if defined(QT_OPENGL_ES) && defined(Q_OS_ANDROID)
1249 ::glClearDepthf(depth);
1250#else
1251 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1252 d_ptr->f.ClearDepthf(depth);
1253#endif
1254 Q_OPENGL_FUNCTIONS_DEBUG
1255}
1256
1257inline void QOpenGLFunctions::glCompileShader(GLuint shader)
1258{
1259#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1260 ::glCompileShader(shader);
1261#else
1262 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1263 d_ptr->f.CompileShader(shader);
1264#endif
1265 Q_OPENGL_FUNCTIONS_DEBUG
1266}
1267
1268inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
1269{
1270#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1271 ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
1272#else
1273 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1274 d_ptr->f.CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
1275#endif
1276 Q_OPENGL_FUNCTIONS_DEBUG
1277}
1278
1279inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
1280{
1281#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1282 ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
1283#else
1284 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1285 d_ptr->f.CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
1286#endif
1287 Q_OPENGL_FUNCTIONS_DEBUG
1288}
1289
1290inline GLuint QOpenGLFunctions::glCreateProgram()
1291{
1292#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1293 GLuint result = ::glCreateProgram();
1294#else
1295 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1296 GLuint result = d_ptr->f.CreateProgram();
1297#endif
1298 Q_OPENGL_FUNCTIONS_DEBUG
1299 return result;
1300}
1301
1302inline GLuint QOpenGLFunctions::glCreateShader(GLenum type)
1303{
1304#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1305 GLuint result = ::glCreateShader(type);
1306#else
1307 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1308 GLuint result = d_ptr->f.CreateShader(type);
1309#endif
1310 Q_OPENGL_FUNCTIONS_DEBUG
1311 return result;
1312}
1313
1314inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
1315{
1316#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1317 ::glDeleteBuffers(n, buffers);
1318#else
1319 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1320 d_ptr->f.DeleteBuffers(n, buffers);
1321#endif
1322 Q_OPENGL_FUNCTIONS_DEBUG
1323}
1324
1325inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
1326{
1327#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1328 ::glDeleteFramebuffers(n, framebuffers);
1329#else
1330 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1331 d_ptr->f.DeleteFramebuffers(n, framebuffers);
1332#endif
1333 Q_OPENGL_FUNCTIONS_DEBUG
1334}
1335
1336inline void QOpenGLFunctions::glDeleteProgram(GLuint program)
1337{
1338#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1339 ::glDeleteProgram(program);
1340#else
1341 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1342 d_ptr->f.DeleteProgram(program);
1343#endif
1344 Q_OPENGL_FUNCTIONS_DEBUG
1345}
1346
1347inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
1348{
1349#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1350 ::glDeleteRenderbuffers(n, renderbuffers);
1351#else
1352 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1353 d_ptr->f.DeleteRenderbuffers(n, renderbuffers);
1354#endif
1355 Q_OPENGL_FUNCTIONS_DEBUG
1356}
1357
1358inline void QOpenGLFunctions::glDeleteShader(GLuint shader)
1359{
1360#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1361 ::glDeleteShader(shader);
1362#else
1363 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1364 d_ptr->f.DeleteShader(shader);
1365#endif
1366 Q_OPENGL_FUNCTIONS_DEBUG
1367}
1368
1369inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
1370{
1371#if defined(QT_OPENGL_ES) && defined(Q_OS_ANDROID)
1372 ::glDepthRangef(zNear, zFar);
1373#else
1374 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1375 d_ptr->f.DepthRangef(zNear, zFar);
1376#endif
1377 Q_OPENGL_FUNCTIONS_DEBUG
1378}
1379
1380inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader)
1381{
1382#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1383 ::glDetachShader(program, shader);
1384#else
1385 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1386 d_ptr->f.DetachShader(program, shader);
1387#endif
1388 Q_OPENGL_FUNCTIONS_DEBUG
1389}
1390
1391inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index)
1392{
1393#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1394 ::glDisableVertexAttribArray(index);
1395#else
1396 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1397 d_ptr->f.DisableVertexAttribArray(index);
1398#endif
1399 Q_OPENGL_FUNCTIONS_DEBUG
1400}
1401
1402inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index)
1403{
1404#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1405 ::glEnableVertexAttribArray(index);
1406#else
1407 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1408 d_ptr->f.EnableVertexAttribArray(index);
1409#endif
1410 Q_OPENGL_FUNCTIONS_DEBUG
1411}
1412
1413inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
1414{
1415#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1416 ::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
1417#else
1418 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1419 d_ptr->f.FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
1420#endif
1421 Q_OPENGL_FUNCTIONS_DEBUG
1422}
1423
1424inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
1425{
1426#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1427 ::glFramebufferTexture2D(target, attachment, textarget, texture, level);
1428#else
1429 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1430 d_ptr->f.FramebufferTexture2D(target, attachment, textarget, texture, level);
1431#endif
1432 Q_OPENGL_FUNCTIONS_DEBUG
1433}
1434
1435inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
1436{
1437#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1438 ::glGenBuffers(n, buffers);
1439#else
1440 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1441 d_ptr->f.GenBuffers(n, buffers);
1442#endif
1443 Q_OPENGL_FUNCTIONS_DEBUG
1444}
1445
1446inline void QOpenGLFunctions::glGenerateMipmap(GLenum target)
1447{
1448#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1449 ::glGenerateMipmap(target);
1450#else
1451 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1452 d_ptr->f.GenerateMipmap(target);
1453#endif
1454 Q_OPENGL_FUNCTIONS_DEBUG
1455}
1456
1457inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
1458{
1459#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1460 ::glGenFramebuffers(n, framebuffers);
1461#else
1462 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1463 d_ptr->f.GenFramebuffers(n, framebuffers);
1464#endif
1465 Q_OPENGL_FUNCTIONS_DEBUG
1466}
1467
1468inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
1469{
1470#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1471 ::glGenRenderbuffers(n, renderbuffers);
1472#else
1473 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1474 d_ptr->f.GenRenderbuffers(n, renderbuffers);
1475#endif
1476 Q_OPENGL_FUNCTIONS_DEBUG
1477}
1478
1479inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
1480{
1481#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1482 ::glGetActiveAttrib(program, index, bufsize, length, size, type, name);
1483#else
1484 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1485 d_ptr->f.GetActiveAttrib(program, index, bufsize, length, size, type, name);
1486#endif
1487 Q_OPENGL_FUNCTIONS_DEBUG
1488}
1489
1490inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
1491{
1492#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1493 ::glGetActiveUniform(program, index, bufsize, length, size, type, name);
1494#else
1495 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1496 d_ptr->f.GetActiveUniform(program, index, bufsize, length, size, type, name);
1497#endif
1498 Q_OPENGL_FUNCTIONS_DEBUG
1499}
1500
1501inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
1502{
1503#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1504 ::glGetAttachedShaders(program, maxcount, count, shaders);
1505#else
1506 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1507 d_ptr->f.GetAttachedShaders(program, maxcount, count, shaders);
1508#endif
1509 Q_OPENGL_FUNCTIONS_DEBUG
1510}
1511
1512inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* name)
1513{
1514#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1515 GLint result = ::glGetAttribLocation(program, name);
1516#else
1517 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1518 GLint result = d_ptr->f.GetAttribLocation(program, name);
1519#endif
1520 Q_OPENGL_FUNCTIONS_DEBUG
1521 return result;
1522}
1523
1524inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
1525{
1526#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1527 ::glGetBufferParameteriv(target, pname, params);
1528#else
1529 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1530 d_ptr->f.GetBufferParameteriv(target, pname, params);
1531#endif
1532 Q_OPENGL_FUNCTIONS_DEBUG
1533}
1534
1535inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
1536{
1537#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1538 ::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
1539#else
1540 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1541 d_ptr->f.GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
1542#endif
1543 Q_OPENGL_FUNCTIONS_DEBUG
1544}
1545
1546inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params)
1547{
1548#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1549 ::glGetProgramiv(program, pname, params);
1550#else
1551 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1552 d_ptr->f.GetProgramiv(program, pname, params);
1553#endif
1554 Q_OPENGL_FUNCTIONS_DEBUG
1555}
1556
1557inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
1558{
1559#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1560 ::glGetProgramInfoLog(program, bufsize, length, infolog);
1561#else
1562 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1563 d_ptr->f.GetProgramInfoLog(program, bufsize, length, infolog);
1564#endif
1565 Q_OPENGL_FUNCTIONS_DEBUG
1566}
1567
1568inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
1569{
1570#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1571 ::glGetRenderbufferParameteriv(target, pname, params);
1572#else
1573 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1574 d_ptr->f.GetRenderbufferParameteriv(target, pname, params);
1575#endif
1576 Q_OPENGL_FUNCTIONS_DEBUG
1577}
1578
1579inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
1580{
1581#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1582 ::glGetShaderiv(shader, pname, params);
1583#else
1584 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1585 d_ptr->f.GetShaderiv(shader, pname, params);
1586#endif
1587 Q_OPENGL_FUNCTIONS_DEBUG
1588}
1589
1590inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
1591{
1592#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1593 ::glGetShaderInfoLog(shader, bufsize, length, infolog);
1594#else
1595 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1596 d_ptr->f.GetShaderInfoLog(shader, bufsize, length, infolog);
1597#endif
1598 Q_OPENGL_FUNCTIONS_DEBUG
1599}
1600
1601inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
1602{
1603#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1604 ::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
1605#else
1606 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1607 d_ptr->f.GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
1608#endif
1609 Q_OPENGL_FUNCTIONS_DEBUG
1610}
1611
1612inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
1613{
1614#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1615 ::glGetShaderSource(shader, bufsize, length, source);
1616#else
1617 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1618 d_ptr->f.GetShaderSource(shader, bufsize, length, source);
1619#endif
1620 Q_OPENGL_FUNCTIONS_DEBUG
1621}
1622
1623inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params)
1624{
1625#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1626 ::glGetUniformfv(program, location, params);
1627#else
1628 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1629 d_ptr->f.GetUniformfv(program, location, params);
1630#endif
1631 Q_OPENGL_FUNCTIONS_DEBUG
1632}
1633
1634inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params)
1635{
1636#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1637 ::glGetUniformiv(program, location, params);
1638#else
1639 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1640 d_ptr->f.GetUniformiv(program, location, params);
1641#endif
1642 Q_OPENGL_FUNCTIONS_DEBUG
1643}
1644
1645inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char* name)
1646{
1647#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1648 GLint result = ::glGetUniformLocation(program, name);
1649#else
1650 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1651 GLint result = d_ptr->f.GetUniformLocation(program, name);
1652#endif
1653 Q_OPENGL_FUNCTIONS_DEBUG
1654 return result;
1655}
1656
1657inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
1658{
1659#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1660 ::glGetVertexAttribfv(index, pname, params);
1661#else
1662 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1663 d_ptr->f.GetVertexAttribfv(index, pname, params);
1664#endif
1665 Q_OPENGL_FUNCTIONS_DEBUG
1666}
1667
1668inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
1669{
1670#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1671 ::glGetVertexAttribiv(index, pname, params);
1672#else
1673 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1674 d_ptr->f.GetVertexAttribiv(index, pname, params);
1675#endif
1676 Q_OPENGL_FUNCTIONS_DEBUG
1677}
1678
1679inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
1680{
1681#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1682 ::glGetVertexAttribPointerv(index, pname, pointer);
1683#else
1684 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1685 d_ptr->f.GetVertexAttribPointerv(index, pname, pointer);
1686#endif
1687 Q_OPENGL_FUNCTIONS_DEBUG
1688}
1689
1690inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer)
1691{
1692#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1693 GLboolean result = ::glIsBuffer(buffer);
1694#else
1695 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1696 GLboolean result = d_ptr->f.IsBuffer(buffer);
1697#endif
1698 Q_OPENGL_FUNCTIONS_DEBUG
1699 return result;
1700}
1701
1702inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer)
1703{
1704#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1705 GLboolean result = ::glIsFramebuffer(framebuffer);
1706#else
1707 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1708 GLboolean result = d_ptr->f.IsFramebuffer(framebuffer);
1709#endif
1710 Q_OPENGL_FUNCTIONS_DEBUG
1711 return result;
1712}
1713
1714inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program)
1715{
1716#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1717 GLboolean result = ::glIsProgram(program);
1718#else
1719 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1720 GLboolean result = d_ptr->f.IsProgram(program);
1721#endif
1722 Q_OPENGL_FUNCTIONS_DEBUG
1723 return result;
1724}
1725
1726inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
1727{
1728#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1729 GLboolean result = ::glIsRenderbuffer(renderbuffer);
1730#else
1731 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1732 GLboolean result = d_ptr->f.IsRenderbuffer(renderbuffer);
1733#endif
1734 Q_OPENGL_FUNCTIONS_DEBUG
1735 return result;
1736}
1737
1738inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader)
1739{
1740#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1741 GLboolean result = ::glIsShader(shader);
1742#else
1743 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1744 GLboolean result = d_ptr->f.IsShader(shader);
1745#endif
1746 Q_OPENGL_FUNCTIONS_DEBUG
1747 return result;
1748}
1749
1750inline void QOpenGLFunctions::glLinkProgram(GLuint program)
1751{
1752#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1753 ::glLinkProgram(program);
1754#else
1755 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1756 d_ptr->f.LinkProgram(program);
1757#endif
1758 Q_OPENGL_FUNCTIONS_DEBUG
1759}
1760
1761inline void QOpenGLFunctions::glReleaseShaderCompiler()
1762{
1763#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1764 ::glReleaseShaderCompiler();
1765#else
1766 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1767 d_ptr->f.ReleaseShaderCompiler();
1768#endif
1769 Q_OPENGL_FUNCTIONS_DEBUG
1770}
1771
1772inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
1773{
1774#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1775 ::glRenderbufferStorage(target, internalformat, width, height);
1776#else
1777 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1778 d_ptr->f.RenderbufferStorage(target, internalformat, width, height);
1779#endif
1780 Q_OPENGL_FUNCTIONS_DEBUG
1781}
1782
1783inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
1784{
1785#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1786 ::glSampleCoverage(value, invert);
1787#else
1788 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1789 d_ptr->f.SampleCoverage(value, invert);
1790#endif
1791 Q_OPENGL_FUNCTIONS_DEBUG
1792}
1793
1794inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
1795{
1796#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1797 ::glShaderBinary(n, shaders, binaryformat, binary, length);
1798#else
1799 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1800 d_ptr->f.ShaderBinary(n, shaders, binaryformat, binary, length);
1801#endif
1802 Q_OPENGL_FUNCTIONS_DEBUG
1803}
1804
1805inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
1806{
1807#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1808 ::glShaderSource(shader, count, string, length);
1809#else
1810 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1811 d_ptr->f.ShaderSource(shader, count, string, length);
1812#endif
1813 Q_OPENGL_FUNCTIONS_DEBUG
1814}
1815
1816inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
1817{
1818#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1819 ::glStencilFuncSeparate(face, func, ref, mask);
1820#else
1821 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1822 d_ptr->f.StencilFuncSeparate(face, func, ref, mask);
1823#endif
1824 Q_OPENGL_FUNCTIONS_DEBUG
1825}
1826
1827inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
1828{
1829#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1830 ::glStencilMaskSeparate(face, mask);
1831#else
1832 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1833 d_ptr->f.StencilMaskSeparate(face, mask);
1834#endif
1835 Q_OPENGL_FUNCTIONS_DEBUG
1836}
1837
1838inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
1839{
1840#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1841 ::glStencilOpSeparate(face, fail, zfail, zpass);
1842#else
1843 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1844 d_ptr->f.StencilOpSeparate(face, fail, zfail, zpass);
1845#endif
1846 Q_OPENGL_FUNCTIONS_DEBUG
1847}
1848
1849inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x)
1850{
1851#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1852 ::glUniform1f(location, x);
1853#else
1854 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1855 d_ptr->f.Uniform1f(location, x);
1856#endif
1857 Q_OPENGL_FUNCTIONS_DEBUG
1858}
1859
1860inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
1861{
1862#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1863 ::glUniform1fv(location, count, v);
1864#else
1865 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1866 d_ptr->f.Uniform1fv(location, count, v);
1867#endif
1868 Q_OPENGL_FUNCTIONS_DEBUG
1869}
1870
1871inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x)
1872{
1873#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1874 ::glUniform1i(location, x);
1875#else
1876 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1877 d_ptr->f.Uniform1i(location, x);
1878#endif
1879 Q_OPENGL_FUNCTIONS_DEBUG
1880}
1881
1882inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v)
1883{
1884#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1885 ::glUniform1iv(location, count, v);
1886#else
1887 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1888 d_ptr->f.Uniform1iv(location, count, v);
1889#endif
1890 Q_OPENGL_FUNCTIONS_DEBUG
1891}
1892
1893inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
1894{
1895#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1896 ::glUniform2f(location, x, y);
1897#else
1898 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1899 d_ptr->f.Uniform2f(location, x, y);
1900#endif
1901 Q_OPENGL_FUNCTIONS_DEBUG
1902}
1903
1904inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
1905{
1906#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1907 ::glUniform2fv(location, count, v);
1908#else
1909 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1910 d_ptr->f.Uniform2fv(location, count, v);
1911#endif
1912 Q_OPENGL_FUNCTIONS_DEBUG
1913}
1914
1915inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
1916{
1917#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1918 ::glUniform2i(location, x, y);
1919#else
1920 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1921 d_ptr->f.Uniform2i(location, x, y);
1922#endif
1923 Q_OPENGL_FUNCTIONS_DEBUG
1924}
1925
1926inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v)
1927{
1928#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1929 ::glUniform2iv(location, count, v);
1930#else
1931 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1932 d_ptr->f.Uniform2iv(location, count, v);
1933#endif
1934 Q_OPENGL_FUNCTIONS_DEBUG
1935}
1936
1937inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
1938{
1939#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1940 ::glUniform3f(location, x, y, z);
1941#else
1942 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1943 d_ptr->f.Uniform3f(location, x, y, z);
1944#endif
1945 Q_OPENGL_FUNCTIONS_DEBUG
1946}
1947
1948inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
1949{
1950#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1951 ::glUniform3fv(location, count, v);
1952#else
1953 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1954 d_ptr->f.Uniform3fv(location, count, v);
1955#endif
1956 Q_OPENGL_FUNCTIONS_DEBUG
1957}
1958
1959inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z)
1960{
1961#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1962 ::glUniform3i(location, x, y, z);
1963#else
1964 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1965 d_ptr->f.Uniform3i(location, x, y, z);
1966#endif
1967 Q_OPENGL_FUNCTIONS_DEBUG
1968}
1969
1970inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v)
1971{
1972#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1973 ::glUniform3iv(location, count, v);
1974#else
1975 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1976 d_ptr->f.Uniform3iv(location, count, v);
1977#endif
1978 Q_OPENGL_FUNCTIONS_DEBUG
1979}
1980
1981inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1982{
1983#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1984 ::glUniform4f(location, x, y, z, w);
1985#else
1986 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1987 d_ptr->f.Uniform4f(location, x, y, z, w);
1988#endif
1989 Q_OPENGL_FUNCTIONS_DEBUG
1990}
1991
1992inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
1993{
1994#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
1995 ::glUniform4fv(location, count, v);
1996#else
1997 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
1998 d_ptr->f.Uniform4fv(location, count, v);
1999#endif
2000 Q_OPENGL_FUNCTIONS_DEBUG
2001}
2002
2003inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
2004{
2005#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2006 ::glUniform4i(location, x, y, z, w);
2007#else
2008 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2009 d_ptr->f.Uniform4i(location, x, y, z, w);
2010#endif
2011 Q_OPENGL_FUNCTIONS_DEBUG
2012}
2013
2014inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v)
2015{
2016#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2017 ::glUniform4iv(location, count, v);
2018#else
2019 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2020 d_ptr->f.Uniform4iv(location, count, v);
2021#endif
2022 Q_OPENGL_FUNCTIONS_DEBUG
2023}
2024
2025inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
2026{
2027#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2028 ::glUniformMatrix2fv(location, count, transpose, value);
2029#else
2030 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2031 d_ptr->f.UniformMatrix2fv(location, count, transpose, value);
2032#endif
2033 Q_OPENGL_FUNCTIONS_DEBUG
2034}
2035
2036inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
2037{
2038#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2039 ::glUniformMatrix3fv(location, count, transpose, value);
2040#else
2041 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2042 d_ptr->f.UniformMatrix3fv(location, count, transpose, value);
2043#endif
2044 Q_OPENGL_FUNCTIONS_DEBUG
2045}
2046
2047inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
2048{
2049#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2050 ::glUniformMatrix4fv(location, count, transpose, value);
2051#else
2052 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2053 d_ptr->f.UniformMatrix4fv(location, count, transpose, value);
2054#endif
2055 Q_OPENGL_FUNCTIONS_DEBUG
2056}
2057
2058inline void QOpenGLFunctions::glUseProgram(GLuint program)
2059{
2060#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2061 ::glUseProgram(program);
2062#else
2063 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2064 d_ptr->f.UseProgram(program);
2065#endif
2066 Q_OPENGL_FUNCTIONS_DEBUG
2067}
2068
2069inline void QOpenGLFunctions::glValidateProgram(GLuint program)
2070{
2071#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2072 ::glValidateProgram(program);
2073#else
2074 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2075 d_ptr->f.ValidateProgram(program);
2076#endif
2077 Q_OPENGL_FUNCTIONS_DEBUG
2078}
2079
2080inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
2081{
2082#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2083 ::glVertexAttrib1f(indx, x);
2084#else
2085 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2086 d_ptr->f.VertexAttrib1f(indx, x);
2087#endif
2088 Q_OPENGL_FUNCTIONS_DEBUG
2089}
2090
2091inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values)
2092{
2093#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2094 ::glVertexAttrib1fv(indx, values);
2095#else
2096 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2097 d_ptr->f.VertexAttrib1fv(indx, values);
2098#endif
2099 Q_OPENGL_FUNCTIONS_DEBUG
2100}
2101
2102inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
2103{
2104#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2105 ::glVertexAttrib2f(indx, x, y);
2106#else
2107 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2108 d_ptr->f.VertexAttrib2f(indx, x, y);
2109#endif
2110 Q_OPENGL_FUNCTIONS_DEBUG
2111}
2112
2113inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values)
2114{
2115#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2116 ::glVertexAttrib2fv(indx, values);
2117#else
2118 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2119 d_ptr->f.VertexAttrib2fv(indx, values);
2120#endif
2121 Q_OPENGL_FUNCTIONS_DEBUG
2122}
2123
2124inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
2125{
2126#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2127 ::glVertexAttrib3f(indx, x, y, z);
2128#else
2129 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2130 d_ptr->f.VertexAttrib3f(indx, x, y, z);
2131#endif
2132 Q_OPENGL_FUNCTIONS_DEBUG
2133}
2134
2135inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values)
2136{
2137#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2138 ::glVertexAttrib3fv(indx, values);
2139#else
2140 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2141 d_ptr->f.VertexAttrib3fv(indx, values);
2142#endif
2143 Q_OPENGL_FUNCTIONS_DEBUG
2144}
2145
2146inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
2147{
2148#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2149 ::glVertexAttrib4f(indx, x, y, z, w);
2150#else
2151 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2152 d_ptr->f.VertexAttrib4f(indx, x, y, z, w);
2153#endif
2154 Q_OPENGL_FUNCTIONS_DEBUG
2155}
2156
2157inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values)
2158{
2159#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2160 ::glVertexAttrib4fv(indx, values);
2161#else
2162 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2163 d_ptr->f.VertexAttrib4fv(indx, values);
2164#endif
2165 Q_OPENGL_FUNCTIONS_DEBUG
2166}
2167
2168inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
2169{
2170#if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
2171 ::glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
2172#else
2173 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
2174 d_ptr->f.VertexAttribPointer(indx, size, type, normalized, stride, ptr);
2175#endif
2176 Q_OPENGL_FUNCTIONS_DEBUG
2177}
2178
2179#undef QT_OPENGL_DECLARE_FUNCTIONS
2180#undef QT_OPENGL_COUNT_FUNCTIONS
2181#undef QT_OPENGL_DECLARE
2182
2183QT_END_NAMESPACE
2184
2185#endif // QT_NO_OPENGL
2186
2187#endif
2188