QtBase  v6.3.1
qopengltexturehelper_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtOpenGL 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 QOPENGLTEXTUREHELPER_P_H
41 #define QOPENGLTEXTUREHELPER_P_H
42 
43 //
44 // W A R N I N G
45 // -------------
46 //
47 // This file is not part of the Qt API. It exists purely as an
48 // implementation detail. This header file may change from version to
49 // version without notice, or even be removed.
50 //
51 // We mean it.
52 //
53 
54 #include <QtOpenGL/qtopenglglobal.h>
55 
56 #ifndef QT_NO_OPENGL
57 
58 #include "qopengl.h"
60 #include "qopengltexture.h"
61 #include "qopenglfunctions.h"
62 
64 
65 // Constants for OpenGL and OpenGL ES 3.0+ which are not available with OpenGL ES 2.0.
66 #ifndef GL_TEXTURE_BASE_LEVEL
67 #define GL_TEXTURE_BASE_LEVEL 0x813C
68 #endif
69 #ifndef GL_TEXTURE_MAX_LEVEL
70 #define GL_TEXTURE_MAX_LEVEL 0x813D
71 #endif
72 #ifndef GL_TEXTURE_COMPARE_MODE
73 #define GL_TEXTURE_COMPARE_MODE 0x884C
74 #endif
75 #ifndef GL_TEXTURE_COMPARE_FUNC
76 #define GL_TEXTURE_COMPARE_FUNC 0x884D
77 #endif
78 
79 // use GL_APICALL only on Android + __clang__
80 #if !defined(Q_OS_ANDROID) || !defined(__clang__)
81 # undef GL_APICALL
82 # define GL_APICALL
83 #elif !defined(GL_APICALL)
84 # define GL_APICALL
85 #endif
86 
87 class QOpenGLContext;
88 
90 {
91 public:
93 
94  // DSA-like API. Will either use real DSA or our emulation
96  {
97  (this->*TextureParameteri)(texture, target, bindingTarget, pname, param);
98  }
99 
101  {
102  (this->*TextureParameteriv)(texture, target, bindingTarget, pname, params);
103  }
104 
106  {
107  (this->*TextureParameterf)(texture, target, bindingTarget, pname, param);
108  }
109 
111  {
112  (this->*TextureParameterfv)(texture, target, bindingTarget, pname, params);
113  }
114 
116  {
117  (this->*GenerateTextureMipmap)(texture, target, bindingTarget);
118  }
119 
122  {
123  (this->*TextureStorage3D)(texture, target, bindingTarget, levels, internalFormat, width, height, depth);
124  }
125 
128  {
129  (this->*TextureStorage2D)(texture, target, bindingTarget, levels, internalFormat, width, height);
130  }
131 
133  GLsizei width)
134  {
135  (this->*TextureStorage1D)(texture, target, bindingTarget, levels, internalFormat, width);
136  }
137 
140  {
141  (this->*TextureStorage3DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, depth, fixedSampleLocations);
142  }
143 
146  {
147  (this->*TextureStorage2DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, fixedSampleLocations);
148  }
149 
152  {
153  (this->*TextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, format, type, pixels);
154  }
155 
158  {
159  (this->*TextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, format, type, pixels);
160  }
161 
163  GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
164  {
165  (this->*TextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, format, type, pixels);
166  }
167 
170  const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr)
171  {
172  if (options) {
174  setPixelUploadOptions(*options);
175  (this->*TextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
176  setPixelUploadOptions(oldOptions);
177  } else {
178  (this->*TextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
179  }
180  }
181 
184  const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr)
185  {
186  if (options) {
188  setPixelUploadOptions(*options);
189  (this->*TextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, type, pixels);
190  setPixelUploadOptions(oldOptions);
191  } else {
192  (this->*TextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, type, pixels);
193  }
194  }
195 
198  const GLvoid *pixels, const QOpenGLPixelTransferOptions * const options = nullptr)
199  {
200  if (options) {
202  setPixelUploadOptions(*options);
203  (this->*TextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, type, pixels);
204  setPixelUploadOptions(oldOptions);
205  } else {
206  (this->*TextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, type, pixels);
207  }
208  }
209 
212  {
213  (this->*TextureImage3DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, depth, fixedSampleLocations);
214  }
215 
218  {
219  (this->*TextureImage2DMultisample)(texture, target, bindingTarget, samples, internalFormat, width, height, fixedSampleLocations);
220  }
221 
224  GLenum format, GLsizei imageSize, const GLvoid *bits,
225  const QOpenGLPixelTransferOptions * const options = nullptr)
226  {
227  if (options) {
229  setPixelUploadOptions(*options);
230  (this->*CompressedTextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, imageSize, bits);
231  setPixelUploadOptions(oldOptions);
232  } else {
233  (this->*CompressedTextureSubImage1D)(texture, target, bindingTarget, level, xoffset, width, format, imageSize, bits);
234  }
235  }
236 
240  GLenum format, GLsizei imageSize, const GLvoid *bits,
241  const QOpenGLPixelTransferOptions * const options = nullptr)
242  {
243  if (options) {
245  setPixelUploadOptions(*options);
246  (this->*CompressedTextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, imageSize, bits);
247  setPixelUploadOptions(oldOptions);
248  } else {
249  (this->*CompressedTextureSubImage2D)(texture, target, bindingTarget, level, xoffset, yoffset, width, height, format, imageSize, bits);
250  }
251  }
252 
256  GLenum format, GLsizei imageSize, const GLvoid *bits,
257  const QOpenGLPixelTransferOptions * const options = nullptr)
258  {
259  if (options) {
261  setPixelUploadOptions(*options);
262  (this->*CompressedTextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits);
263  setPixelUploadOptions(oldOptions);
264  } else {
265  (this->*CompressedTextureSubImage3D)(texture, target, bindingTarget, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits);
266  }
267  }
268 
271  GLint border, GLsizei imageSize, const GLvoid *bits,
272  const QOpenGLPixelTransferOptions * const options = nullptr)
273  {
274  if (options) {
276  setPixelUploadOptions(*options);
277  (this->*CompressedTextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, imageSize, bits);
278  setPixelUploadOptions(oldOptions);
279  } else {
280  (this->*CompressedTextureImage1D)(texture, target, bindingTarget, level, internalFormat, width, border, imageSize, bits);
281  }
282  }
283 
286  GLint border, GLsizei imageSize, const GLvoid *bits,
287  const QOpenGLPixelTransferOptions * const options = nullptr)
288 
289  {
290  if (options) {
292  setPixelUploadOptions(*options);
293  (this->*CompressedTextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, imageSize, bits);
294  setPixelUploadOptions(oldOptions);
295  } else {
296  (this->*CompressedTextureImage2D)(texture, target, bindingTarget, level, internalFormat, width, height, border, imageSize, bits);
297  }
298  }
299 
302  GLint border, GLsizei imageSize, const GLvoid *bits,
303  const QOpenGLPixelTransferOptions * const options = nullptr)
304  {
305  if (options) {
307  setPixelUploadOptions(*options);
308  (this->*CompressedTextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, imageSize, bits);
309  setPixelUploadOptions(oldOptions);
310  } else {
311  (this->*CompressedTextureImage3D)(texture, target, bindingTarget, level, internalFormat, width, height, depth, border, imageSize, bits);
312  }
313  }
314 
315 private:
316  // DSA wrapper (so we can use pointer to member function as switch)
317  void dsa_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param);
318 
319  void dsa_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params);
320 
321  void dsa_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param);
322 
323  void dsa_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params);
324 
325  void dsa_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget);
326 
327  void dsa_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
329 
330  void dsa_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
332 
333  void dsa_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat,
334  GLsizei width);
335 
336  void dsa_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat,
338 
339  void dsa_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat,
341 
342  void dsa_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
344 
345  void dsa_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
347 
348  void dsa_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
349  GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
350 
351  void dsa_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
353 
354  void dsa_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset,
356 
357  void dsa_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset,
358  GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
359 
360  void dsa_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat,
362 
363  void dsa_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat,
365 
366  void dsa_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
368  GLenum format, GLsizei imageSize, const GLvoid *bits);
369 
370  void dsa_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
373  GLenum format, GLsizei imageSize, const GLvoid *bits);
374 
375  void dsa_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
378  GLenum format, GLsizei imageSize, const GLvoid *bits);
379 
380  void dsa_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
382  GLint border, GLsizei imageSize, const GLvoid *bits);
383 
384  void dsa_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
386  GLint border, GLsizei imageSize, const GLvoid *bits);
387 
388  void dsa_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
390  GLint border, GLsizei imageSize, const GLvoid *bits);
391 
392  // DSA emulation API
393  void qt_TextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param);
394 
395  void qt_TextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params);
396 
397  void qt_TextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param);
398 
399  void qt_TextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params);
400 
401  void qt_GenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget);
402 
403  void qt_TextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels,
405 
406  void qt_TextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels,
408 
409  void qt_TextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels,
411 
412  void qt_TextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples,
415 
416  void qt_TextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples,
419 
420  void qt_TextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
423  const GLvoid *pixels);
424 
425  void qt_TextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
428  const GLvoid *pixels);
429 
430  void qt_TextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
432  const GLvoid *pixels);
433 
434  void qt_TextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
437  GLenum format, GLenum type, const GLvoid *pixels);
438 
439  void qt_TextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
442  GLenum format, GLenum type, const GLvoid *pixels);
443 
444  void qt_TextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
446  GLenum format, GLenum type, const GLvoid *pixels);
447 
448  void qt_TextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples,
451 
452  void qt_TextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples,
455 
456  void qt_CompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
458  GLsizei imageSize, const GLvoid *bits);
459 
460  void qt_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
463  GLenum format, GLsizei imageSize, const GLvoid *bits);
464 
465  void qt_CompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level,
468  GLenum format, GLsizei imageSize, const GLvoid *bits);
469 
470  void qt_CompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
472  GLsizei imageSize, const GLvoid *bits);
473 
474  void qt_CompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
476  GLsizei imageSize, const GLvoid *bits);
477 
478  void qt_CompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat,
480  GLsizei imageSize, const GLvoid *bits);
481 
482 public:
483  // Raw OpenGL functions, resolved and used by our DSA-like static functions if no EXT_direct_state_access is available
484 
485  // OpenGL 1.0
488  GLenum format, GLenum type, const GLvoid *pixels)
489  {
491  }
492 
493  // OpenGL 1.1
495  GLenum format, GLenum type, const GLvoid *pixels)
496  {
497  TexSubImage1D(target, level, xoffset, width, format, type, pixels);
498  }
499 
500  // OpenGL 1.2
503  GLenum format, GLenum type, const GLvoid *pixels)
504  {
506  }
507 
510  {
511  TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
512  }
513 
514  // OpenGL 1.3
516  {
517  GetCompressedTexImage(target, level, img);
518  }
519 
521  GLenum format, GLsizei imageSize, const GLvoid *data)
522  {
523  CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data);
524  }
525 
528  {
529  CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
530  }
531 
534  {
535  CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
536  }
537 
539  GLint border, GLsizei imageSize, const GLvoid *data)
540  {
541  CompressedTexImage1D(target, level, internalFormat, width, border, imageSize, data);
542  }
543 
545  GLint border, GLsizei imageSize, const GLvoid *data)
546  {
547  CompressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, data);
548  }
549 
552  GLint border, GLsizei imageSize, const GLvoid *data)
553  {
554  CompressedTexImage3D(target, level, internalFormat, width, height, depth, border, imageSize, data);
555  }
556 
558  {
559  ActiveTexture(texture);
560  }
561 
562  // OpenGL 3.0
564  {
565  GenerateMipmap(target);
566  }
567 
568  // OpenGL 3.2
572  {
573  TexImage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);
574  }
575 
579  {
580  TexImage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);
581  }
582 
583  // OpenGL 4.2
585  {
586  TexStorage3D(target, levels, internalFormat, width, height, depth);
587  }
588 
590  {
591  TexStorage2D(target, levels, internalFormat, width, height);
592  }
593 
595  {
596  TexStorage1D(target, levels, internalFormat, width);
597  }
598 
599  // OpenGL 4.3
602  {
603  TexStorage3DMultisample(target, samples, internalFormat, width, height, depth, fixedSampleLocations);
604  }
605 
608  {
609  TexStorage2DMultisample(target, samples, internalFormat, width, height, fixedSampleLocations);
610  }
611 
614  {
615  TexBufferRange(target, internalFormat, buffer, offset, size);
616  }
617 
619  GLuint minLevel, GLuint numLevels, GLuint minLayer, GLuint numLayers)
620  {
621  TextureView(texture, target, origTexture, internalFormat, minLevel, numLevels, minLayer, numLayers);
622  }
623 
624  // Helper functions
626  {
628  int val = 0;
629  functions->glGetIntegerv(GL_UNPACK_ALIGNMENT, &val);
630  options.setAlignment(val);
631 #if !QT_CONFIG(opengles2)
633  options.setSkipImages(val);
634  functions->glGetIntegerv(GL_UNPACK_SKIP_ROWS, &val);
635  options.setSkipRows(val);
636  functions->glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &val);
637  options.setSkipPixels(val);
639  options.setImageHeight(val);
641  options.setRowLength(val);
642  GLboolean b = GL_FALSE;
643  functions->glGetBooleanv(GL_UNPACK_LSB_FIRST, &b);
645  functions->glGetBooleanv(GL_UNPACK_SWAP_BYTES, &b);
646  options.setSwapBytesEnabled(b);
647 #endif
648  return options;
649  }
650 
652  {
653  functions->glPixelStorei(GL_UNPACK_ALIGNMENT, options.alignment());
654 #if !QT_CONFIG(opengles2)
656  functions->glPixelStorei(GL_UNPACK_SKIP_ROWS, options.skipRows());
657  functions->glPixelStorei(GL_UNPACK_SKIP_PIXELS, options.skipPixels());
660  functions->glPixelStorei(GL_UNPACK_LSB_FIRST, options.isLeastSignificantBitFirst());
661  functions->glPixelStorei(GL_UNPACK_SWAP_BYTES, options.isSwapBytesEnabled());
662 #endif
663  }
664 
666 private:
667  // Typedefs and pointers to member functions used to switch between EXT_direct_state_access and our own emulated DSA.
668  // The argument match the corresponding GL function, but there's an extra "GLenum bindingTarget" which gets used with
669  // the DSA emulation -- it contains the right GL_BINDING_TEXTURE_X to use.
670  typedef void (QOpenGLTextureHelper::*TextureParameteriMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param);
671  typedef void (QOpenGLTextureHelper::*TextureParameterivMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params);
672  typedef void (QOpenGLTextureHelper::*TextureParameterfMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param);
673  typedef void (QOpenGLTextureHelper::*TextureParameterfvMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params);
674  typedef void (QOpenGLTextureHelper::*GenerateTextureMipmapMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget);
675  typedef void (QOpenGLTextureHelper::*TextureStorage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);
676  typedef void (QOpenGLTextureHelper::*TextureStorage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height);
677  typedef void (QOpenGLTextureHelper::*TextureStorage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width);
678  typedef void (QOpenGLTextureHelper::*TextureStorage3DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
679  typedef void (QOpenGLTextureHelper::*TextureStorage2DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
680  typedef void (QOpenGLTextureHelper::*TextureImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
681  typedef void (QOpenGLTextureHelper::*TextureImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
682  typedef void (QOpenGLTextureHelper::*TextureImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
683  typedef void (QOpenGLTextureHelper::*TextureSubImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
684  typedef void (QOpenGLTextureHelper::*TextureSubImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
685  typedef void (QOpenGLTextureHelper::*TextureSubImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
686  typedef void (QOpenGLTextureHelper::*TextureImage3DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
687  typedef void (QOpenGLTextureHelper::*TextureImage2DMultisampleMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
688  typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
689  typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
690  typedef void (QOpenGLTextureHelper::*CompressedTextureSubImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
691  typedef void (QOpenGLTextureHelper::*CompressedTextureImage1DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
692  typedef void (QOpenGLTextureHelper::*CompressedTextureImage2DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
693  typedef void (QOpenGLTextureHelper::*CompressedTextureImage3DMemberFunc)(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
694 
695 
696  TextureParameteriMemberFunc TextureParameteri;
697  TextureParameterivMemberFunc TextureParameteriv;
698  TextureParameterfMemberFunc TextureParameterf;
699  TextureParameterfvMemberFunc TextureParameterfv;
700  GenerateTextureMipmapMemberFunc GenerateTextureMipmap;
701  TextureStorage3DMemberFunc TextureStorage3D;
702  TextureStorage2DMemberFunc TextureStorage2D;
703  TextureStorage1DMemberFunc TextureStorage1D;
704  TextureStorage3DMultisampleMemberFunc TextureStorage3DMultisample;
705  TextureStorage2DMultisampleMemberFunc TextureStorage2DMultisample;
706  TextureImage3DMemberFunc TextureImage3D;
707  TextureImage2DMemberFunc TextureImage2D;
708  TextureImage1DMemberFunc TextureImage1D;
709  TextureSubImage3DMemberFunc TextureSubImage3D;
710  TextureSubImage2DMemberFunc TextureSubImage2D;
711  TextureSubImage1DMemberFunc TextureSubImage1D;
712  TextureImage3DMultisampleMemberFunc TextureImage3DMultisample;
713  TextureImage2DMultisampleMemberFunc TextureImage2DMultisample;
714  CompressedTextureSubImage1DMemberFunc CompressedTextureSubImage1D;
715  CompressedTextureSubImage2DMemberFunc CompressedTextureSubImage2D;
716  CompressedTextureSubImage3DMemberFunc CompressedTextureSubImage3D;
717  CompressedTextureImage1DMemberFunc CompressedTextureImage1D;
718  CompressedTextureImage2DMemberFunc CompressedTextureImage2D;
719  CompressedTextureImage3DMemberFunc CompressedTextureImage3D;
720 
721  // Raw function pointers for core and DSA functions
722 
723  // EXT_direct_state_access used when DSA is available
724  void (QOPENGLF_APIENTRYP TextureParameteriEXT)(GLuint texture, GLenum target, GLenum pname, GLint param);
725  void (QOPENGLF_APIENTRYP TextureParameterivEXT)(GLuint texture, GLenum target, GLenum pname, const GLint *params);
726  void (QOPENGLF_APIENTRYP TextureParameterfEXT)(GLuint texture, GLenum target, GLenum pname, GLfloat param);
727  void (QOPENGLF_APIENTRYP TextureParameterfvEXT)(GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
728  void (QOPENGLF_APIENTRYP GenerateTextureMipmapEXT)(GLuint texture, GLenum target);
739  void (QOPENGLF_APIENTRYP TextureSubImage1DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
740  void (QOPENGLF_APIENTRYP CompressedTextureSubImage1DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
743  void (QOPENGLF_APIENTRYP CompressedTextureImage1DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
746 
747 
748  // Plus some missing ones that are in the NV_texture_multisample extension instead
751 
752  // OpenGL 1.0
754 
755  // OpenGL 1.1
756  void (QOPENGLF_APIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
757 
758  // OpenGL 1.2
761 
762  // OpenGL 1.3
763  void (QOPENGLF_APIENTRYP GetCompressedTexImage)(GLenum target, GLint level, GLvoid *img);
764  void (QOPENGLF_APIENTRYP CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
767  void (QOPENGLF_APIENTRYP CompressedTexImage1D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
770  GL_APICALL void (QOPENGLF_APIENTRYP ActiveTexture)(GLenum texture);
771 
772  // OpenGL 3.0
773  GL_APICALL void (QOPENGLF_APIENTRYP GenerateMipmap)(GLenum target);
774 
775  // OpenGL 3.2
778 
779  // OpenGL 4.2
783 
784  // OpenGL 4.3
789 };
790 
792 
793 #undef Q_CALL_MEMBER_FUNCTION
794 
795 #endif // QT_NO_OPENGL
796 
797 #endif // QOPENGLTEXTUREHELPER_P_H
The QOpenGLContext class represents a native OpenGL context, enabling OpenGL rendering on a QSurface.
The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API.
void glPixelStorei(GLenum pname, GLint param)
void glGetBooleanv(GLenum pname, GLboolean *params)
void glGetIntegerv(GLenum pname, GLint *params)
The QOpenGLPixelTransferOptions class describes the pixel storage modes that affect the unpacking of ...
void glTextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)
void glTextureView(GLuint texture, GLenum target, GLuint origTexture, GLenum internalFormat, GLuint minLevel, GLuint numLevels, GLuint minLayer, GLuint numLayers)
void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width)
void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)
void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
void glCompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
void setPixelUploadOptions(const QOpenGLPixelTransferOptions &options)
QOpenGLFunctions * functions
void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
void glTextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
void glTextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
void glActiveTexture(GLenum texture)
void glTextureParameterfv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLfloat *params)
void glTextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width)
void glTextureParameteriv(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, const GLint *params)
QOpenGLPixelTransferOptions savePixelUploadOptions()
void glTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void glTextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
void glGetCompressedTexImage(GLenum target, GLint level, GLvoid *img)
void glGenerateTextureMipmap(GLuint texture, GLenum target, GLenum bindingTarget)
void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void glTextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)
void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
void glGenerateMipmap(GLenum target)
void glTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)
void glCompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glCompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureParameterf(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLfloat param)
void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
void glCompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void glTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const QOpenGLPixelTransferOptions *const options=nullptr)
void glCompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
void glCompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
QOpenGLTextureHelper(QOpenGLContext *context)
void glTextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param)
void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
void glTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer, GLintptr offset, GLsizeiptr size)
ptrdiff_t GLintptr
Definition: qopengl.h:189
#define QOPENGLF_APIENTRYP
Definition: qopengl.h:301
GLenum type
Definition: qopengl.h:270
ptrdiff_t GLsizeiptr
Definition: qopengl.h:190
GLenum GLuint GLenum GLuint GLuint GLuint GLuint numlayers
GLboolean GLboolean GLboolean b
typedef GLint(GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC)(GLuint program
GLint GLenum GLsizei GLsizei GLsizei depth
typedef GLfloat(GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC)(GLuint path
GLsizei samples
GLenum GLuint GLint level
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint origtexture
GLenum GLuint GLenum GLuint GLuint GLuint minlayer
GLsizei GLenum GLsizei GLsizei GLboolean fixedSampleLocations
GLuint numLayers
GLenum pname
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLsizei levels
GLenum GLuint buffer
GLint GLint GLint yoffset
GLint GLsizei width
GLint GLint GLint GLint zoffset
typedef GLsizei(GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC)(GLuint target)
GLenum GLuint GLenum GLuint GLuint numlevels
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
GLenum target
GLenum GLuint texture
GLint GLenum internalformat
GLenum GLuint GLenum GLuint minlevel
GLint GLint xoffset
typedef GLboolean(GL_APIENTRYP PFNGLISENABLEDIOESPROC)(GLenum target
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum const GLint * param
GLenum GLuint GLintptr offset
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum const void * pixels
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count
GLint GLsizei GLsizei GLenum format
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
GLsizei GLenum internalFormat
void ** params
GLuint GLfloat * val
Definition: qopenglext.h:1513
GLint void * img
Definition: qopenglext.h:233
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
Definition: qopenglext.h:6904
#define GL_UNPACK_SKIP_IMAGES
Definition: qopenglext.h:82
#define GL_UNPACK_IMAGE_HEIGHT
Definition: qopenglext.h:83
#define GL_APICALL
#define GL_UNPACK_ROW_LENGTH