QtBase  v6.3.1
qopenglextensions_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QOPENGL_EXTENSIONS_P_H
41 #define QOPENGL_EXTENSIONS_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 for the convenience
48 // of the Qt OpenGL classes. This header file may change from
49 // version to version without notice, or even be removed.
50 //
51 // We mean it.
52 //
53 
54 #include <QtGui/private/qtguiglobal_p.h>
55 #include "qopenglextrafunctions.h"
56 
58 
60 
61 class Q_GUI_EXPORT QOpenGLExtensions : public QOpenGLExtraFunctions
62 {
63  Q_DECLARE_PRIVATE(QOpenGLExtensions)
64 public:
68 
70  TextureRectangle = 0x00000001,
71  GenerateMipmap = 0x00000002,
72  TextureCompression = 0x00000004,
73  MirroredRepeat = 0x00000008,
74  FramebufferMultisample = 0x00000010,
75  StencilTwoSide = 0x00000020,
76  StencilWrap = 0x00000040,
77  PackedDepthStencil = 0x00000080,
78  NVFloatBuffer = 0x00000100,
79  PixelBufferObject = 0x00000200,
80  FramebufferBlit = 0x00000400,
81  BGRATextureFormat = 0x00000800,
82  DDSTextureCompression = 0x00001000,
83  ETC1TextureCompression = 0x00002000,
84  PVRTCTextureCompression = 0x00004000,
85  ElementIndexUint = 0x00008000,
86  Depth24 = 0x00010000,
87  SRGBFrameBuffer = 0x00020000,
88  MapBuffer = 0x00040000,
89  GeometryShaders = 0x00080000,
90  MapBufferRange = 0x00100000,
91  Sized8Formats = 0x00200000,
92  DiscardFramebuffer = 0x00400000,
93  Sized16Formats = 0x00800000,
94  TextureSwizzle = 0x01000000,
95  StandardDerivatives = 0x02000000,
96  ASTCTextureCompression = 0x04000000,
97  ETC2TextureCompression = 0x08000000
98  };
99  Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension)
100 
101  OpenGLExtensions openGLExtensions();
102  bool hasOpenGLExtension(QOpenGLExtensions::OpenGLExtension extension) const;
103 
104  GLvoid *glMapBuffer(GLenum target, GLenum access);
105  void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data);
106  void glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
107 
108  void flushShared();
109 
110  QOpenGLExtensionsPrivate *d() const;
111 
112 private:
113  static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != nullptr; }
114 };
115 
116 Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLExtensions::OpenGLExtensions)
117 
119 {
120 public:
122 
126 
129 };
130 
132 {
133  return static_cast<QOpenGLExtensionsPrivate *>(d_ptr);
134 }
135 
137 {
138  Q_D(QOpenGLExtensions);
139  Q_ASSERT(QOpenGLExtensions::isInitialized(d));
140  GLvoid *result = d->MapBuffer(target, access);
142  return result;
143 }
144 
146 {
147  Q_D(QOpenGLExtensions);
148  Q_ASSERT(QOpenGLExtensions::isInitialized(d));
149  d->GetBufferSubData(target, offset, size, data);
151 }
152 
153 
155 {
156  Q_D(QOpenGLExtensions);
157  Q_ASSERT(QOpenGLExtensions::isInitialized(d));
158  d->DiscardFramebuffer(target,numAttachments, attachments);
160 }
162 
163 #endif // QOPENGL_EXTENSIONS_P_H
The QOpenGLContext class represents a native OpenGL context, enabling OpenGL rendering on a QSurface.
void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
QOpenGLExtensionsPrivate * d() const
void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data)
GLvoid * glMapBuffer(GLenum target, GLenum access)
GLsizei const GLenum * attachments
GLvoid *QOPENGLF_APIENTRYP MapBuffer(GLenum target, GLenum access)
qopengl_GLintptr qopengl_GLsizeiptr GLvoid * data
The QOpenGLExtraFunctions class provides cross-platform access to the OpenGL ES 3....
QOpenGLFunctionsPrivate * d_ptr
void
Definition: png.h:1080
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition: qflags.h:210
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition: qflags.h:227
#define QOPENGLF_APIENTRYP
Definition: qopengl.h:301
QT_BEGIN_NAMESPACE typedef ptrdiff_t qopengl_GLintptr
Definition: qopengl.h:291
ptrdiff_t qopengl_GLsizeiptr
Definition: qopengl.h:292
GLenum GLuint GLintptr GLsizeiptr size
[1]
typedef GLsizei(GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC)(GLuint target)
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
GLenum access
GLenum target
GLsizei const GLenum * attachments
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLsizei numAttachments
GLuint64EXT * result
[6]
Definition: qopenglext.h:10932
#define Q_OPENGL_FUNCTIONS_DEBUG
#define Q_ASSERT(cond)
Definition: qrandom.cpp:84