Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QOPENGLBUFFER_H
6
#
define
QOPENGLBUFFER_H
7
8
#
include
<
QtOpenGL
/
qtopenglglobal
.
h
>
9
10
#
ifndef
QT_NO_OPENGL
11
12
#
include
<
QtGui
/
qopengl
.
h
>
13
14
QT_BEGIN_NAMESPACE
15
16
17
class
QOpenGLBufferPrivate;
18
19
class
Q_OPENGL_EXPORT
QOpenGLBuffer
20
{
21
public
:
22
enum
Type
23
{
24
VertexBuffer = 0x8892,
// GL_ARRAY_BUFFER
25
IndexBuffer = 0x8893,
// GL_ELEMENT_ARRAY_BUFFER
26
PixelPackBuffer = 0x88EB,
// GL_PIXEL_PACK_BUFFER
27
PixelUnpackBuffer = 0x88EC
// GL_PIXEL_UNPACK_BUFFER
28
};
29
30
QOpenGLBuffer();
31
explicit
QOpenGLBuffer(QOpenGLBuffer::Type type);
32
QOpenGLBuffer(
const
QOpenGLBuffer &other);
33
QOpenGLBuffer(QOpenGLBuffer &&other)
noexcept
34
: d_ptr{std::exchange(other.d_ptr,
nullptr
)} {}
35
~QOpenGLBuffer();
36
37
QOpenGLBuffer &operator=(
const
QOpenGLBuffer &other);
38
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QOpenGLBuffer)
39
40
void
swap(QOpenGLBuffer &other)
noexcept
41
{
return
qt_ptr_swap(d_ptr, other.d_ptr); }
42
43
enum
UsagePattern
44
{
45
StreamDraw = 0x88E0,
// GL_STREAM_DRAW
46
StreamRead = 0x88E1,
// GL_STREAM_READ
47
StreamCopy = 0x88E2,
// GL_STREAM_COPY
48
StaticDraw = 0x88E4,
// GL_STATIC_DRAW
49
StaticRead = 0x88E5,
// GL_STATIC_READ
50
StaticCopy = 0x88E6,
// GL_STATIC_COPY
51
DynamicDraw = 0x88E8,
// GL_DYNAMIC_DRAW
52
DynamicRead = 0x88E9,
// GL_DYNAMIC_READ
53
DynamicCopy = 0x88EA
// GL_DYNAMIC_COPY
54
};
55
56
enum
Access
57
{
58
ReadOnly = 0x88B8,
// GL_READ_ONLY
59
WriteOnly = 0x88B9,
// GL_WRITE_ONLY
60
ReadWrite = 0x88BA
// GL_READ_WRITE
61
};
62
63
enum
RangeAccessFlag
64
{
65
RangeRead = 0x0001,
// GL_MAP_READ_BIT
66
RangeWrite = 0x0002,
// GL_MAP_WRITE_BIT
67
RangeInvalidate = 0x0004,
// GL_MAP_INVALIDATE_RANGE_BIT
68
RangeInvalidateBuffer = 0x0008,
// GL_MAP_INVALIDATE_BUFFER_BIT
69
RangeFlushExplicit = 0x0010,
// GL_MAP_FLUSH_EXPLICIT_BIT
70
RangeUnsynchronized = 0x0020
// GL_MAP_UNSYNCHRONIZED_BIT
71
};
72
Q_DECLARE_FLAGS(RangeAccessFlags, RangeAccessFlag)
73
74
QOpenGLBuffer::Type type()
const
;
75
76
QOpenGLBuffer::UsagePattern usagePattern()
const
;
77
void
setUsagePattern(QOpenGLBuffer::UsagePattern value);
78
79
bool
create();
80
bool
isCreated()
const
;
81
82
void
destroy();
83
84
bool
bind();
85
void
release();
86
87
static
void
release(QOpenGLBuffer::Type type);
88
89
GLuint bufferId()
const
;
90
91
int
size()
const
;
92
93
bool
read(
int
offset,
void
*data,
int
count);
94
void
write(
int
offset,
const
void
*data,
int
count);
95
96
void
allocate(
const
void
*data,
int
count);
97
inline
void
allocate(
int
count) { allocate(
nullptr
, count); }
98
99
void
*map(QOpenGLBuffer::Access access);
100
void
*mapRange(
int
offset,
int
count, QOpenGLBuffer::RangeAccessFlags access);
101
bool
unmap();
102
103
private
:
104
QOpenGLBufferPrivate *d_ptr;
105
106
Q_DECLARE_PRIVATE(QOpenGLBuffer)
107
};
108
Q_DECLARE_SHARED
(
QOpenGLBuffer
)
109
110
Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLBuffer::RangeAccessFlags)
111
112
QT_END_NAMESPACE
113
114
#
endif
// QT_NO_OPENGL
115
116
#
endif
QOpenGLBuffer
The QOpenGLBuffer class provides functions for creating and managing OpenGL buffer objects.
Definition
qopenglbuffer.h:20
qtbase
src
opengl
qopenglbuffer.h
Generated on
for Qt by
1.18.0