1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QOPENGLFUNCTIONS_H
5#define QOPENGLFUNCTIONS_H
6
7#include <QtGui/qtguiglobal.h>
8
9#ifndef QT_NO_OPENGL
10
11#ifdef __GLEW_H__
12#if defined(Q_CC_GNU)
13#warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
14#warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h
15#endif
16#endif
17
18#include <QtGui/qopengl.h>
19#include <QtGui/qopenglcontext.h>
20
21//#define Q_ENABLE_OPENGL_FUNCTIONS_DEBUG
22
23#if QT_CONFIG(opengles2)
24typedef double GLdouble;
25#endif
26
27#ifdef Q_ENABLE_OPENGL_FUNCTIONS_DEBUG
28#include <stdio.h>
29#define Q_OPENGL_FUNCTIONS_DEBUG \
30 GLenum error = glGetError(); \
31 if (error != GL_NO_ERROR) { \
32 unsigned clamped = qMin(unsigned(error - GL_INVALID_ENUM), 4U); \
33 const char *errors[] = { "GL_INVALID_ENUM", "GL_INVALID_VALUE", "GL_INVALID_OPERATION", "Unknown" }; \
34 printf("GL error at %s:%d: %s\n", __FILE__, __LINE__, errors[clamped]); \
35 int *value = nullptr; \
36 *value = 0; \
37 }
38#else
39#define Q_OPENGL_FUNCTIONS_DEBUG
40#endif
41
42QT_BEGIN_NAMESPACE
43
44struct QOpenGLFunctionsPrivate;
45
46// Undefine any macros from GLEW, qopenglextensions_p.h, etc that
47// may interfere with the definition of QOpenGLFunctions.
48#undef glBindTexture
49#undef glBlendFunc
50#undef glClear
51#undef glClearColor
52#undef glClearStencil
53#undef glColorMask
54#undef glCopyTexImage2D
55#undef glCopyTexSubImage2D
56#undef glCullFace
57#undef glDeleteTextures
58#undef glDepthFunc
59#undef glDepthMask
60#undef glDisable
61#undef glDrawArrays
62#undef glDrawElements
63#undef glEnable
64#undef glFinish
65#undef glFlush
66#undef glFrontFace
67#undef glGenTextures
68#undef glGetBooleanv
69#undef glGetError
70#undef glGetFloatv
71#undef glGetIntegerv
72#undef glGetString
73#undef glGetTexParameterfv
74#undef glGetTexParameteriv
75#undef glHint
76#undef glIsEnabled
77#undef glIsTexture
78#undef glLineWidth
79#undef glPixelStorei
80#undef glPolygonOffset
81#undef glReadPixels
82#undef glScissor
83#undef glStencilFunc
84#undef glStencilMask
85#undef glStencilOp
86#undef glTexImage2D
87#undef glTexParameterf
88#undef glTexParameterfv
89#undef glTexParameteri
90#undef glTexParameteriv
91#undef glTexSubImage2D
92#undef glViewport
93
94#undef glActiveTexture
95#undef glAttachShader
96#undef glBindAttribLocation
97#undef glBindBuffer
98#undef glBindFramebuffer
99#undef glBindRenderbuffer
100#undef glBlendColor
101#undef glBlendEquation
102#undef glBlendEquationSeparate
103#undef glBlendFuncSeparate
104#undef glBufferData
105#undef glBufferSubData
106#undef glCheckFramebufferStatus
107#undef glClearDepthf
108#undef glCompileShader
109#undef glCompressedTexImage2D
110#undef glCompressedTexSubImage2D
111#undef glCreateProgram
112#undef glCreateShader
113#undef glDeleteBuffers
114#undef glDeleteFramebuffers
115#undef glDeleteProgram
116#undef glDeleteRenderbuffers
117#undef glDeleteShader
118#undef glDepthRangef
119#undef glDetachShader
120#undef glDisableVertexAttribArray
121#undef glEnableVertexAttribArray
122#undef glFramebufferRenderbuffer
123#undef glFramebufferTexture2D
124#undef glGenBuffers
125#undef glGenerateMipmap
126#undef glGenFramebuffers
127#undef glGenRenderbuffers
128#undef glGetActiveAttrib
129#undef glGetActiveUniform
130#undef glGetAttachedShaders
131#undef glGetAttribLocation
132#undef glGetBufferParameteriv
133#undef glGetFramebufferAttachmentParameteriv
134#undef glGetProgramiv
135#undef glGetProgramInfoLog
136#undef glGetRenderbufferParameteriv
137#undef glGetShaderiv
138#undef glGetShaderInfoLog
139#undef glGetShaderPrecisionFormat
140#undef glGetShaderSource
141#undef glGetUniformfv
142#undef glGetUniformiv
143#undef glGetUniformLocation
144#undef glGetVertexAttribfv
145#undef glGetVertexAttribiv
146#undef glGetVertexAttribPointerv
147#undef glIsBuffer
148#undef glIsFramebuffer
149#undef glIsProgram
150#undef glIsRenderbuffer
151#undef glIsShader
152#undef glLinkProgram
153#undef glReleaseShaderCompiler
154#undef glRenderbufferStorage
155#undef glSampleCoverage
156#undef glShaderBinary
157#undef glShaderSource
158#undef glStencilFuncSeparate
159#undef glStencilMaskSeparate
160#undef glStencilOpSeparate
161#undef glUniform1f
162#undef glUniform1fv
163#undef glUniform1i
164#undef glUniform1iv
165#undef glUniform2f
166#undef glUniform2fv
167#undef glUniform2i
168#undef glUniform2iv
169#undef glUniform3f
170#undef glUniform3fv
171#undef glUniform3i
172#undef glUniform3iv
173#undef glUniform4f
174#undef glUniform4fv
175#undef glUniform4i
176#undef glUniform4iv
177#undef glUniformMatrix2fv
178#undef glUniformMatrix3fv
179#undef glUniformMatrix4fv
180#undef glUseProgram
181#undef glValidateProgram
182#undef glVertexAttrib1f
183#undef glVertexAttrib1fv
184#undef glVertexAttrib2f
185#undef glVertexAttrib2fv
186#undef glVertexAttrib3f
187#undef glVertexAttrib3fv
188#undef glVertexAttrib4f
189#undef glVertexAttrib4fv
190#undef glVertexAttribPointer
191
192#undef glTexLevelParameteriv
193
194#if defined(Q_QDOC)
195#undef GLbitfield
196typedef unsigned int GLbitfield;
197#undef GLchar
198typedef char GLchar;
199#endif
200
201class Q_GUI_EXPORT QOpenGLFunctions
202{
203public:
204 QOpenGLFunctions();
205 explicit QOpenGLFunctions(QOpenGLContext *context);
206 ~QOpenGLFunctions() {}
207
208 enum OpenGLFeature
209 {
210 Multitexture = 0x0001,
211 Shaders = 0x0002,
212 Buffers = 0x0004,
213 Framebuffers = 0x0008,
214 BlendColor = 0x0010,
215 BlendEquation = 0x0020,
216 BlendEquationSeparate = 0x0040,
217 BlendFuncSeparate = 0x0080,
218 BlendSubtract = 0x0100,
219 CompressedTextures = 0x0200,
220 Multisample = 0x0400,
221 StencilSeparate = 0x0800,
222 NPOTTextures = 0x1000,
223 NPOTTextureRepeat = 0x2000,
224 FixedFunctionPipeline = 0x4000,
225 TextureRGFormats = 0x8000,
226 MultipleRenderTargets = 0x10000,
227 BlendEquationAdvanced = 0x20000,
228 };
229 Q_DECLARE_FLAGS(OpenGLFeatures, OpenGLFeature)
230
231 QOpenGLFunctions::OpenGLFeatures openGLFeatures() const;
232 bool hasOpenGLFeature(QOpenGLFunctions::OpenGLFeature feature) const;
233
234 void initializeOpenGLFunctions();
235
236 // GLES2 + OpenGL1 common subset
237 void glBindTexture(GLenum target, GLuint texture);
238 void glBlendFunc(GLenum sfactor, GLenum dfactor);
239 void glClear(GLbitfield mask);
240 void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
241 void glClearStencil(GLint s);
242 void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
243 void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
244 void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
245 void glCullFace(GLenum mode);
246 void glDeleteTextures(GLsizei n, const GLuint* textures);
247 void glDepthFunc(GLenum func);
248 void glDepthMask(GLboolean flag);
249 void glDisable(GLenum cap);
250 void glDrawArrays(GLenum mode, GLint first, GLsizei count);
251 void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
252 void glEnable(GLenum cap);
253 void glFinish();
254 void glFlush();
255 void glFrontFace(GLenum mode);
256 void glGenTextures(GLsizei n, GLuint* textures);
257 void glGetBooleanv(GLenum pname, GLboolean* params);
258 GLenum glGetError();
259 void glGetFloatv(GLenum pname, GLfloat* params);
260 void glGetIntegerv(GLenum pname, GLint* params);
261 const GLubyte *glGetString(GLenum name);
262 void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
263 void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
264 void glHint(GLenum target, GLenum mode);
265 GLboolean glIsEnabled(GLenum cap);
266 GLboolean glIsTexture(GLuint texture);
267 void glLineWidth(GLfloat width);
268 void glPixelStorei(GLenum pname, GLint param);
269 void glPolygonOffset(GLfloat factor, GLfloat units);
270 void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
271 void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
272 void glStencilFunc(GLenum func, GLint ref, GLuint mask);
273 void glStencilMask(GLuint mask);
274 void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
275 void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
276 void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
277 void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
278 void glTexParameteri(GLenum target, GLenum pname, GLint param);
279 void glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
280 void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
281 void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
282
283 // GL(ES)2
284 void glActiveTexture(GLenum texture);
285 void glAttachShader(GLuint program, GLuint shader);
286 void glBindAttribLocation(GLuint program, GLuint index, const char* name);
287 void glBindBuffer(GLenum target, GLuint buffer);
288 void glBindFramebuffer(GLenum target, GLuint framebuffer);
289 void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
290 void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
291 void glBlendEquation(GLenum mode);
292 void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
293 void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
294 void glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage);
295 void glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data);
296 GLenum glCheckFramebufferStatus(GLenum target);
297 void glClearDepthf(GLclampf depth);
298 void glCompileShader(GLuint shader);
299 void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
300 void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
301 GLuint glCreateProgram();
302 GLuint glCreateShader(GLenum type);
303 void glDeleteBuffers(GLsizei n, const GLuint* buffers);
304 void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
305 void glDeleteProgram(GLuint program);
306 void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
307 void glDeleteShader(GLuint shader);
308 void glDepthRangef(GLclampf zNear, GLclampf zFar);
309 void glDetachShader(GLuint program, GLuint shader);
310 void glDisableVertexAttribArray(GLuint index);
311 void glEnableVertexAttribArray(GLuint index);
312 void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
313 void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
314 void glGenBuffers(GLsizei n, GLuint* buffers);
315 void glGenerateMipmap(GLenum target);
316 void glGenFramebuffers(GLsizei n, GLuint* framebuffers);
317 void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers);
318 void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
319 void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
320 void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
321 GLint glGetAttribLocation(GLuint program, const char* name);
322 void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
323 void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
324 void glGetProgramiv(GLuint program, GLenum pname, GLint* params);
325 void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
326 void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
327 void glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
328 void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
329 void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
330 void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
331 void glGetUniformfv(GLuint program, GLint location, GLfloat* params);
332 void glGetUniformiv(GLuint program, GLint location, GLint* params);
333 GLint glGetUniformLocation(GLuint program, const char* name);
334 void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
335 void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
336 void glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer);
337 GLboolean glIsBuffer(GLuint buffer);
338 GLboolean glIsFramebuffer(GLuint framebuffer);
339 GLboolean glIsProgram(GLuint program);
340 GLboolean glIsRenderbuffer(GLuint renderbuffer);
341 GLboolean glIsShader(GLuint shader);
342 void glLinkProgram(GLuint program);
343 void glReleaseShaderCompiler();
344 void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
345 void glSampleCoverage(GLclampf value, GLboolean invert);
346 void glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
347 void glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length);
348 void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
349 void glStencilMaskSeparate(GLenum face, GLuint mask);
350 void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
351 void glUniform1f(GLint location, GLfloat x);
352 void glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
353 void glUniform1i(GLint location, GLint x);
354 void glUniform1iv(GLint location, GLsizei count, const GLint* v);
355 void glUniform2f(GLint location, GLfloat x, GLfloat y);
356 void glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
357 void glUniform2i(GLint location, GLint x, GLint y);
358 void glUniform2iv(GLint location, GLsizei count, const GLint* v);
359 void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
360 void glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
361 void glUniform3i(GLint location, GLint x, GLint y, GLint z);
362 void glUniform3iv(GLint location, GLsizei count, const GLint* v);
363 void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
364 void glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
365 void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
366 void glUniform4iv(GLint location, GLsizei count, const GLint* v);
367 void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
368 void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
369 void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
370 void glUseProgram(GLuint program);
371 void glValidateProgram(GLuint program);
372 void glVertexAttrib1f(GLuint indx, GLfloat x);
373 void glVertexAttrib1fv(GLuint indx, const GLfloat* values);
374 void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
375 void glVertexAttrib2fv(GLuint indx, const GLfloat* values);
376 void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
377 void glVertexAttrib3fv(GLuint indx, const GLfloat* values);
378 void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
379 void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
380 void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
381
382protected:
383 QOpenGLFunctionsPrivate *d_ptr;
384 static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != nullptr; }
385};
386
387Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLFunctions::OpenGLFeatures)
388
389#define QT_OPENGL_DECLARE_FUNCTIONS(ret, name, args) \
390 ret (QOPENGLF_APIENTRYP name)args;
391#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
392
393#define QT_OPENGL_DECLARE(FUNCTIONS) \
394public: \
395 struct Functions { \
396 FUNCTIONS(QT_OPENGL_DECLARE_FUNCTIONS) \
397 }; \
398 union { \
399 QFunctionPointer functions[FUNCTIONS(QT_OPENGL_COUNT_FUNCTIONS)]; \
400 Functions f; \
401 }; \
402private: \
403 void init(QOpenGLContext *context);
404
405struct QOpenGLFunctionsPrivate
406{
407 QOpenGLFunctionsPrivate(QOpenGLContext *ctx);
408
409#define QT_OPENGL_FUNCTIONS(F) \
410 F(void, BindTexture, (GLenum target, GLuint texture)) \
411 F(void, BlendFunc, (GLenum sfactor, GLenum dfactor)) \
412 F(void, Clear, (GLbitfield mask)) \
413 F(void, ClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \
414 F(void, ClearDepthf, (GLclampf depth)) \
415 F(void, ClearStencil, (GLint s)) \
416 F(void, ColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) \
417 F(void, CopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) \
418 F(void, CopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \
419 F(void, CullFace, (GLenum mode)) \
420 F(void, DeleteTextures, (GLsizei n, const GLuint* textures)) \
421 F(void, DepthFunc, (GLenum func)) \
422 F(void, DepthMask, (GLboolean flag)) \
423 F(void, DepthRangef, (GLclampf nearVal, GLclampf farVal)) \
424 F(void, Disable, (GLenum cap)) \
425 F(void, DrawArrays, (GLenum mode, GLint first, GLsizei count)) \
426 F(void, DrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)) \
427 F(void, Enable, (GLenum cap)) \
428 F(void, Finish, ()) \
429 F(void, Flush, ()) \
430 F(void, FrontFace, (GLenum mode)) \
431 F(void, GenTextures, (GLsizei n, GLuint* textures)) \
432 F(void, GetBooleanv, (GLenum pname, GLboolean* params)) \
433 F(GLenum, GetError, ()) \
434 F(void, GetFloatv, (GLenum pname, GLfloat* params)) \
435 F(void, GetIntegerv, (GLenum pname, GLint* params)) \
436 F(const GLubyte *, GetString, (GLenum name)) \
437 F(void, GetTexParameterfv, (GLenum target, GLenum pname, GLfloat* params)) \
438 F(void, GetTexParameteriv, (GLenum target, GLenum pname, GLint* params)) \
439 F(void, Hint, (GLenum target, GLenum mode)) \
440 F(GLboolean, IsEnabled, (GLenum cap)) \
441 F(GLboolean, IsTexture, (GLuint texture)) \
442 F(void, LineWidth, (GLfloat width)) \
443 F(void, PixelStorei, (GLenum pname, GLint param)) \
444 F(void, PolygonOffset, (GLfloat factor, GLfloat units)) \
445 F(void, ReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)) \
446 F(void, Scissor, (GLint x, GLint y, GLsizei width, GLsizei height)) \
447 F(void, StencilFunc, (GLenum func, GLint ref, GLuint mask)) \
448 F(void, StencilMask, (GLuint mask)) \
449 F(void, StencilOp, (GLenum fail, GLenum zfail, GLenum zpass)) \
450 F(void, TexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)) \
451 F(void, TexParameterf, (GLenum target, GLenum pname, GLfloat param)) \
452 F(void, TexParameterfv, (GLenum target, GLenum pname, const GLfloat* params)) \
453 F(void, TexParameteri, (GLenum target, GLenum pname, GLint param)) \
454 F(void, TexParameteriv, (GLenum target, GLenum pname, const GLint* params)) \
455 F(void, TexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)) \
456 F(void, Viewport, (GLint x, GLint y, GLsizei width, GLsizei height)) \
457 F(void, ActiveTexture, (GLenum texture)) \
458 F(void, AttachShader, (GLuint program, GLuint shader)) \
459 F(void, BindAttribLocation, (GLuint program, GLuint index, const char* name)) \
460 F(void, BindBuffer, (GLenum target, GLuint buffer)) \
461 F(void, BindFramebuffer, (GLenum target, GLuint framebuffer)) \
462 F(void, BindRenderbuffer, (GLenum target, GLuint renderbuffer)) \
463 F(void, BlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \
464 F(void, BlendEquation, (GLenum mode)) \
465 F(void, BlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha)) \
466 F(void, BlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)) \
467 F(void, BufferData, (GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage)) \
468 F(void, BufferSubData, (GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data)) \
469 F(GLenum, CheckFramebufferStatus, (GLenum target)) \
470 F(void, CompileShader, (GLuint shader)) \
471 F(void, CompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)) \
472 F(void, CompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)) \
473 F(GLuint, CreateProgram, ()) \
474 F(GLuint, CreateShader, (GLenum type)) \
475 F(void, DeleteBuffers, (GLsizei n, const GLuint* buffers)) \
476 F(void, DeleteFramebuffers, (GLsizei n, const GLuint* framebuffers)) \
477 F(void, DeleteProgram, (GLuint program)) \
478 F(void, DeleteRenderbuffers, (GLsizei n, const GLuint* renderbuffers)) \
479 F(void, DeleteShader, (GLuint shader)) \
480 F(void, DetachShader, (GLuint program, GLuint shader)) \
481 F(void, DisableVertexAttribArray, (GLuint index)) \
482 F(void, EnableVertexAttribArray, (GLuint index)) \
483 F(void, FramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) \
484 F(void, FramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) \
485 F(void, GenBuffers, (GLsizei n, GLuint* buffers)) \
486 F(void, GenerateMipmap, (GLenum target)) \
487 F(void, GenFramebuffers, (GLsizei n, GLuint* framebuffers)) \
488 F(void, GenRenderbuffers, (GLsizei n, GLuint* renderbuffers)) \
489 F(void, GetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)) \
490 F(void, GetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)) \
491 F(void, GetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)) \
492 F(GLint, GetAttribLocation, (GLuint program, const char* name)) \
493 F(void, GetBufferParameteriv, (GLenum target, GLenum pname, GLint* params)) \
494 F(void, GetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint* params)) \
495 F(void, GetProgramiv, (GLuint program, GLenum pname, GLint* params)) \
496 F(void, GetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)) \
497 F(void, GetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint* params)) \
498 F(void, GetShaderiv, (GLuint shader, GLenum pname, GLint* params)) \
499 F(void, GetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)) \
500 F(void, GetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)) \
501 F(void, GetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, char* source)) \
502 F(void, GetUniformfv, (GLuint program, GLint location, GLfloat* params)) \
503 F(void, GetUniformiv, (GLuint program, GLint location, GLint* params)) \
504 F(GLint, GetUniformLocation, (GLuint program, const char* name)) \
505 F(void, GetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params)) \
506 F(void, GetVertexAttribiv, (GLuint index, GLenum pname, GLint* params)) \
507 F(void, GetVertexAttribPointerv, (GLuint index, GLenum pname, void** pointer)) \
508 F(GLboolean, IsBuffer, (GLuint buffer)) \
509 F(GLboolean, IsFramebuffer, (GLuint framebuffer)) \
510 F(GLboolean, IsProgram, (GLuint program)) \
511 F(GLboolean, IsRenderbuffer, (GLuint renderbuffer)) \
512 F(GLboolean, IsShader, (GLuint shader)) \
513 F(void, LinkProgram, (GLuint program)) \
514 F(void, ReleaseShaderCompiler, ()) \
515 F(void, RenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)) \
516 F(void, SampleCoverage, (GLclampf value, GLboolean invert)) \
517 F(void, ShaderBinary, (GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)) \
518 F(void, ShaderSource, (GLuint shader, GLsizei count, const char** string, const GLint* length)) \
519 F(void, StencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask)) \
520 F(void, StencilMaskSeparate, (GLenum face, GLuint mask)) \
521 F(void, StencilOpSeparate, (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)) \
522 F(void, Uniform1f, (GLint location, GLfloat x)) \
523 F(void, Uniform1fv, (GLint location, GLsizei count, const GLfloat* v)) \
524 F(void, Uniform1i, (GLint location, GLint x)) \
525 F(void, Uniform1iv, (GLint location, GLsizei count, const GLint* v)) \
526 F(void, Uniform2f, (GLint location, GLfloat x, GLfloat y)) \
527 F(void, Uniform2fv, (GLint location, GLsizei count, const GLfloat* v)) \
528 F(void, Uniform2i, (GLint location, GLint x, GLint y)) \
529 F(void, Uniform2iv, (GLint location, GLsizei count, const GLint* v)) \
530 F(void, Uniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z)) \
531 F(void, Uniform3fv, (GLint location, GLsizei count, const GLfloat* v)) \
532 F(void, Uniform3i, (GLint location, GLint x, GLint y, GLint z)) \
533 F(void, Uniform3iv, (GLint location, GLsizei count, const GLint* v)) \
534 F(void, Uniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
535 F(void, Uniform4fv, (GLint location, GLsizei count, const GLfloat* v)) \
536 F(void, Uniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w)) \
537 F(void, Uniform4iv, (GLint location, GLsizei count, const GLint* v)) \
538 F(void, UniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
539 F(void, UniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
540 F(void, UniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)) \
541 F(void, UseProgram, (GLuint program)) \
542 F(void, ValidateProgram, (GLuint program)) \
543 F(void, VertexAttrib1f, (GLuint indx, GLfloat x)) \
544 F(void, VertexAttrib1fv, (GLuint indx, const GLfloat* values)) \
545 F(void, VertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y)) \
546 F(void, VertexAttrib2fv, (GLuint indx, const GLfloat* values)) \
547 F(void, VertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z)) \
548 F(void, VertexAttrib3fv, (GLuint indx, const GLfloat* values)) \
549 F(void, VertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \
550 F(void, VertexAttrib4fv, (GLuint indx, const GLfloat* values)) \
551 F(void, VertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)) \
552 F(void, ClearDepth, (GLdouble depth)) \
553 F(void, DepthRange, (GLdouble zNear, GLdouble zFar)) \
554
555 QT_OPENGL_DECLARE(QT_OPENGL_FUNCTIONS)
556};
557
558// GLES2 + OpenGL1 common subset
559
560inline void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture)
561{
562#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
563 ::glBindTexture(target, texture);
564#else
565 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
566 d_ptr->f.BindTexture(target, texture);
567#endif
568 Q_OPENGL_FUNCTIONS_DEBUG
569}
570
571inline void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor)
572{
573#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
574 ::glBlendFunc(sfactor, dfactor);
575#else
576 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
577 d_ptr->f.BlendFunc(sfactor, dfactor);
578#endif
579 Q_OPENGL_FUNCTIONS_DEBUG
580}
581
582inline void QOpenGLFunctions::glClear(GLbitfield mask)
583{
584#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
585 ::glClear(mask);
586#else
587 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
588 d_ptr->f.Clear(mask);
589#endif
590 Q_OPENGL_FUNCTIONS_DEBUG
591}
592
593inline void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
594{
595#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
596 ::glClearColor(red, green, blue, alpha);
597#else
598 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
599 d_ptr->f.ClearColor(red, green, blue, alpha);
600#endif
601 Q_OPENGL_FUNCTIONS_DEBUG
602}
603
604inline void QOpenGLFunctions::glClearStencil(GLint s)
605{
606#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
607 ::glClearStencil(s);
608#else
609 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
610 d_ptr->f.ClearStencil(s);
611#endif
612 Q_OPENGL_FUNCTIONS_DEBUG
613}
614
615inline void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
616{
617#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
618 ::glColorMask(red, green, blue, alpha);
619#else
620 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
621 d_ptr->f.ColorMask(red, green, blue, alpha);
622#endif
623 Q_OPENGL_FUNCTIONS_DEBUG
624}
625
626inline void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
627{
628#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
629 ::glCopyTexImage2D(target, level, internalformat, x, y, width,height, border);
630#else
631 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
632 d_ptr->f.CopyTexImage2D(target, level, internalformat, x, y, width,height, border);
633#endif
634 Q_OPENGL_FUNCTIONS_DEBUG
635}
636
637inline void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
638{
639#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
640 ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
641#else
642 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
643 d_ptr->f.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
644#endif
645 Q_OPENGL_FUNCTIONS_DEBUG
646}
647
648inline void QOpenGLFunctions::glCullFace(GLenum mode)
649{
650#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
651 ::glCullFace(mode);
652#else
653 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
654 d_ptr->f.CullFace(mode);
655#endif
656 Q_OPENGL_FUNCTIONS_DEBUG
657}
658
659inline void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures)
660{
661#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
662 ::glDeleteTextures(n, textures);
663#else
664 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
665 d_ptr->f.DeleteTextures(n, textures);
666#endif
667 Q_OPENGL_FUNCTIONS_DEBUG
668}
669
670inline void QOpenGLFunctions::glDepthFunc(GLenum func)
671{
672#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
673 ::glDepthFunc(func);
674#else
675 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
676 d_ptr->f.DepthFunc(func);
677#endif
678 Q_OPENGL_FUNCTIONS_DEBUG
679}
680
681inline void QOpenGLFunctions::glDepthMask(GLboolean flag)
682{
683#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
684 ::glDepthMask(flag);
685#else
686 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
687 d_ptr->f.DepthMask(flag);
688#endif
689 Q_OPENGL_FUNCTIONS_DEBUG
690}
691
692inline void QOpenGLFunctions::glDisable(GLenum cap)
693{
694#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
695 ::glDisable(cap);
696#else
697 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
698 d_ptr->f.Disable(cap);
699#endif
700 Q_OPENGL_FUNCTIONS_DEBUG
701}
702
703inline void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count)
704{
705#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
706 ::glDrawArrays(mode, first, count);
707#else
708 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
709 d_ptr->f.DrawArrays(mode, first, count);
710#endif
711 Q_OPENGL_FUNCTIONS_DEBUG
712}
713
714inline void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
715{
716#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
717 ::glDrawElements(mode, count, type, indices);
718#else
719 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
720 d_ptr->f.DrawElements(mode, count, type, indices);
721#endif
722 Q_OPENGL_FUNCTIONS_DEBUG
723}
724
725inline void QOpenGLFunctions::glEnable(GLenum cap)
726{
727#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
728 ::glEnable(cap);
729#else
730 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
731 d_ptr->f.Enable(cap);
732#endif
733 Q_OPENGL_FUNCTIONS_DEBUG
734}
735
736inline void QOpenGLFunctions::glFinish()
737{
738#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
739 ::glFinish();
740#else
741 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
742 d_ptr->f.Finish();
743#endif
744 Q_OPENGL_FUNCTIONS_DEBUG
745}
746
747inline void QOpenGLFunctions::glFlush()
748{
749#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
750 ::glFlush();
751#else
752 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
753 d_ptr->f.Flush();
754#endif
755 Q_OPENGL_FUNCTIONS_DEBUG
756}
757
758inline void QOpenGLFunctions::glFrontFace(GLenum mode)
759{
760#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
761 ::glFrontFace(mode);
762#else
763 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
764 d_ptr->f.FrontFace(mode);
765#endif
766 Q_OPENGL_FUNCTIONS_DEBUG
767}
768
769inline void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures)
770{
771#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
772 ::glGenTextures(n, textures);
773#else
774 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
775 d_ptr->f.GenTextures(n, textures);
776#endif
777 Q_OPENGL_FUNCTIONS_DEBUG
778}
779
780inline void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params)
781{
782#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
783 ::glGetBooleanv(pname, params);
784#else
785 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
786 d_ptr->f.GetBooleanv(pname, params);
787#endif
788 Q_OPENGL_FUNCTIONS_DEBUG
789}
790
791inline GLenum QOpenGLFunctions::glGetError()
792{
793#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
794 GLenum result = ::glGetError();
795#else
796 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
797 GLenum result = d_ptr->f.GetError();
798#endif
799 return result;
800}
801
802inline void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params)
803{
804#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
805 ::glGetFloatv(pname, params);
806#else
807 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
808 d_ptr->f.GetFloatv(pname, params);
809#endif
810 Q_OPENGL_FUNCTIONS_DEBUG
811}
812
813inline void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params)
814{
815#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
816 ::glGetIntegerv(pname, params);
817#else
818 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
819 d_ptr->f.GetIntegerv(pname, params);
820#endif
821 Q_OPENGL_FUNCTIONS_DEBUG
822}
823
824inline const GLubyte *QOpenGLFunctions::glGetString(GLenum name)
825{
826#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
827 const GLubyte *result = ::glGetString(name);
828#else
829 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
830 const GLubyte *result = d_ptr->f.GetString(name);
831#endif
832 Q_OPENGL_FUNCTIONS_DEBUG
833 return result;
834}
835
836inline void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
837{
838#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
839 ::glGetTexParameterfv(target, pname, params);
840#else
841 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
842 d_ptr->f.GetTexParameterfv(target, pname, params);
843#endif
844 Q_OPENGL_FUNCTIONS_DEBUG
845}
846
847inline void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
848{
849#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
850 ::glGetTexParameteriv(target, pname, params);
851#else
852 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
853 d_ptr->f.GetTexParameteriv(target, pname, params);
854#endif
855 Q_OPENGL_FUNCTIONS_DEBUG
856}
857
858inline void QOpenGLFunctions::glHint(GLenum target, GLenum mode)
859{
860#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
861 ::glHint(target, mode);
862#else
863 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
864 d_ptr->f.Hint(target, mode);
865#endif
866 Q_OPENGL_FUNCTIONS_DEBUG
867}
868
869inline GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap)
870{
871#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
872 GLboolean result = ::glIsEnabled(cap);
873#else
874 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
875 GLboolean result = d_ptr->f.IsEnabled(cap);
876#endif
877 Q_OPENGL_FUNCTIONS_DEBUG
878 return result;
879}
880
881inline GLboolean QOpenGLFunctions::glIsTexture(GLuint texture)
882{
883#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
884 GLboolean result = ::glIsTexture(texture);
885#else
886 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
887 GLboolean result = d_ptr->f.IsTexture(texture);
888#endif
889 Q_OPENGL_FUNCTIONS_DEBUG
890 return result;
891}
892
893inline void QOpenGLFunctions::glLineWidth(GLfloat width)
894{
895#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
896 ::glLineWidth(width);
897#else
898 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
899 d_ptr->f.LineWidth(width);
900#endif
901 Q_OPENGL_FUNCTIONS_DEBUG
902}
903
904inline void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param)
905{
906#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
907 ::glPixelStorei(pname, param);
908#else
909 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
910 d_ptr->f.PixelStorei(pname, param);
911#endif
912 Q_OPENGL_FUNCTIONS_DEBUG
913}
914
915inline void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units)
916{
917#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
918 ::glPolygonOffset(factor, units);
919#else
920 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
921 d_ptr->f.PolygonOffset(factor, units);
922#endif
923 Q_OPENGL_FUNCTIONS_DEBUG
924}
925
926inline void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
927{
928#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
929 ::glReadPixels(x, y, width, height, format, type, pixels);
930#else
931 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
932 d_ptr->f.ReadPixels(x, y, width, height, format, type, pixels);
933#endif
934 Q_OPENGL_FUNCTIONS_DEBUG
935}
936
937inline void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
938{
939#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
940 ::glScissor(x, y, width, height);
941#else
942 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
943 d_ptr->f.Scissor(x, y, width, height);
944#endif
945 Q_OPENGL_FUNCTIONS_DEBUG
946}
947
948inline void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask)
949{
950#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
951 ::glStencilFunc(func, ref, mask);
952#else
953 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
954 d_ptr->f.StencilFunc(func, ref, mask);
955#endif
956 Q_OPENGL_FUNCTIONS_DEBUG
957}
958
959inline void QOpenGLFunctions::glStencilMask(GLuint mask)
960{
961#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
962 ::glStencilMask(mask);
963#else
964 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
965 d_ptr->f.StencilMask(mask);
966#endif
967 Q_OPENGL_FUNCTIONS_DEBUG
968}
969
970inline void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
971{
972#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
973 ::glStencilOp(fail, zfail, zpass);
974#else
975 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
976 d_ptr->f.StencilOp(fail, zfail, zpass);
977#endif
978 Q_OPENGL_FUNCTIONS_DEBUG
979}
980
981inline void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
982{
983#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
984 ::glTexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
985#else
986 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
987 d_ptr->f.TexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
988#endif
989 Q_OPENGL_FUNCTIONS_DEBUG
990}
991
992inline void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
993{
994#if QT_CONFIG(opengles2) && defined(Q_OS_ANDROID)
995 ::glTexParameterf(target, pname, param);
996#else
997 Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
998 d_ptr->f.TexParameterf(target, pname, param);
999#endif
1000 Q_OPENGL_FUNCTIONS_DEBUG
1001}
1002
1003inline 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
1014inline 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
1025inline 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
1036inline 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
1047inline 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
1060inline 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
1071inline 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
1082inline 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
1093inline 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
1104inline 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
1117inline 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
1128inline 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
1139inline 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
1150inline 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
1161inline 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
1172inline 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
1183inline 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
1194inline 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
1206inline 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
1217inline 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
1228inline 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
1239inline 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
1250inline 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
1262inline 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
1274inline 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
1285inline 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
1296inline 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
1307inline 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
1318inline 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
1329inline 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
1340inline 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
1351inline 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
1362inline 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
1373inline 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
1384inline 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
1395inline 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
1406inline 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
1417inline 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
1428inline 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
1439inline 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
1450inline 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
1461inline 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
1472inline 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
1484inline 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
1495inline 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
1506inline 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
1517inline 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
1528inline 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
1539inline 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
1550inline 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
1561inline 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
1572inline 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
1583inline 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
1594inline 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
1605inline 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
1617inline 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
1628inline 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
1639inline 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
1650inline 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
1662inline 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
1674inline 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
1686inline 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
1698inline 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
1710inline 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
1721inline 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
1732inline 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
1743inline 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
1754inline 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
1765inline 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
1776inline 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
1787inline 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
1798inline 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
1809inline 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
1820inline 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
1831inline 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
1842inline 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
1853inline 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
1864inline 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
1875inline 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
1886inline 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
1897inline 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
1908inline 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
1919inline 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
1930inline 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
1941inline 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
1952inline 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
1963inline 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
1974inline 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
1985inline 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
1996inline 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
2007inline 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
2018inline 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
2029inline 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
2040inline 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
2051inline 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
2062inline 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
2073inline 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
2084inline 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
2095inline 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
2106inline 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
2117inline 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
2128inline 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
2143QT_END_NAMESPACE
2144
2145#endif // QT_NO_OPENGL
2146
2147#endif
2148

source code of qtbase/src/gui/opengl/qopenglfunctions.h