Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qopenglbuffer.h
Go to the documentation of this file.
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 QOPENGLBUFFER_H
5#define QOPENGLBUFFER_H
6
7#include <QtOpenGL/qtopenglglobal.h>
8
9#ifndef QT_NO_OPENGL
10
11#include <QtGui/qopengl.h>
12
14
15
17
18class Q_OPENGL_EXPORT QOpenGLBuffer
19{
20public:
21 enum Type
22 {
23 VertexBuffer = 0x8892, // GL_ARRAY_BUFFER
24 IndexBuffer = 0x8893, // GL_ELEMENT_ARRAY_BUFFER
25 PixelPackBuffer = 0x88EB, // GL_PIXEL_PACK_BUFFER
26 PixelUnpackBuffer = 0x88EC // GL_PIXEL_UNPACK_BUFFER
27 };
28
33 : d_ptr{std::exchange(other.d_ptr, nullptr)} {}
35
36 QOpenGLBuffer &operator=(const QOpenGLBuffer &other);
37 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QOpenGLBuffer)
38
40 { return qt_ptr_swap(d_ptr, other.d_ptr); }
41
43 {
44 StreamDraw = 0x88E0, // GL_STREAM_DRAW
45 StreamRead = 0x88E1, // GL_STREAM_READ
46 StreamCopy = 0x88E2, // GL_STREAM_COPY
47 StaticDraw = 0x88E4, // GL_STATIC_DRAW
48 StaticRead = 0x88E5, // GL_STATIC_READ
49 StaticCopy = 0x88E6, // GL_STATIC_COPY
50 DynamicDraw = 0x88E8, // GL_DYNAMIC_DRAW
51 DynamicRead = 0x88E9, // GL_DYNAMIC_READ
52 DynamicCopy = 0x88EA // GL_DYNAMIC_COPY
53 };
54
55 enum Access
56 {
57 ReadOnly = 0x88B8, // GL_READ_ONLY
58 WriteOnly = 0x88B9, // GL_WRITE_ONLY
59 ReadWrite = 0x88BA // GL_READ_WRITE
60 };
61
63 {
64 RangeRead = 0x0001, // GL_MAP_READ_BIT
65 RangeWrite = 0x0002, // GL_MAP_WRITE_BIT
66 RangeInvalidate = 0x0004, // GL_MAP_INVALIDATE_RANGE_BIT
67 RangeInvalidateBuffer = 0x0008, // GL_MAP_INVALIDATE_BUFFER_BIT
68 RangeFlushExplicit = 0x0010, // GL_MAP_FLUSH_EXPLICIT_BIT
69 RangeUnsynchronized = 0x0020 // GL_MAP_UNSYNCHRONIZED_BIT
70 };
71 Q_DECLARE_FLAGS(RangeAccessFlags, RangeAccessFlag)
72
74
75 QOpenGLBuffer::UsagePattern usagePattern() const;
76 void setUsagePattern(QOpenGLBuffer::UsagePattern value);
77
78 bool create();
79 bool isCreated() const;
80
81 void destroy();
82
83 bool bind();
84 void release();
85
86 static void release(QOpenGLBuffer::Type type);
87
88 GLuint bufferId() const;
89
90 int size() const;
91
92 bool read(int offset, void *data, int count);
93 void write(int offset, const void *data, int count);
94
95 void allocate(const void *data, int count);
96 inline void allocate(int count) { allocate(nullptr, count); }
97
99 void *mapRange(int offset, int count, QOpenGLBuffer::RangeAccessFlags access);
100 bool unmap();
101
102private:
104
105 Q_DECLARE_PRIVATE(QOpenGLBuffer)
106};
107Q_DECLARE_SHARED(QOpenGLBuffer)
108
109Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLBuffer::RangeAccessFlags)
110
112
113#endif // QT_NO_OPENGL
114
115#endif
The QOpenGLBuffer class provides functions for creating and managing OpenGL buffer objects.
Access
This enum defines the access mode for QOpenGLBuffer::map().
QOpenGLBuffer(QOpenGLBuffer &&other) noexcept
RangeAccessFlag
This enum defines the access mode bits for QOpenGLBuffer::mapRange().
void allocate(int count)
This is an overloaded member function, provided for convenience. It differs from the above function o...
UsagePattern
This enum defines the usage pattern of a QOpenGLBuffer object.
Type
This enum defines the type of OpenGL buffer object to create with QOpenGLBuffer.
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum type
GLenum access
GLenum GLuint GLintptr offset
#define GLuint
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
Definition qswap.h:29
ReturnedValue read(const char *data)
gzip write("uncompressed data")
sem release()
QSharedPointer< T > other(t)
[5]
this swap(other)
socketLayer bind(QHostAddress::Any, 4000)
view create()
Definition moc.h:23