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
qopenglvertexarrayobject.h
Go to the documentation of this file.
1// Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Sean Harmer <sean.harmer@kdab.com>
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 QOPENGLVERTEXARRAYOBJECT_H
5#define QOPENGLVERTEXARRAYOBJECT_H
6
7#include <QtOpenGL/qtopenglglobal.h>
8
9#ifndef QT_NO_OPENGL
10
11#include <QtCore/QObject>
12#include <QtGui/qopengl.h>
13
15
17
18class Q_OPENGL_EXPORT QOpenGLVertexArrayObject : public QObject
19{
21
22public:
23 explicit QOpenGLVertexArrayObject(QObject* parent = nullptr);
25
26 bool create();
27 void destroy();
28 bool isCreated() const;
29 GLuint objectId() const;
30 void bind();
31 void release();
32
33 class Binder
34 {
35 public:
37 : vao(v)
38 {
39 Q_ASSERT(v);
40 if (vao->isCreated() || vao->create())
41 vao->bind();
42 }
43
44 inline ~Binder()
45 {
46 release();
47 }
48
49 inline void release()
50 {
51 vao->release();
52 }
53
54 inline void rebind()
55 {
56 vao->bind();
57 }
58
59 private:
60 Q_DISABLE_COPY(Binder)
62 };
63
64private:
65 Q_DISABLE_COPY(QOpenGLVertexArrayObject)
66 Q_DECLARE_PRIVATE(QOpenGLVertexArrayObject)
67 Q_PRIVATE_SLOT(d_func(), void _q_contextAboutToBeDestroyed())
69};
70
72
73#endif
74
75#endif // QOPENGLVERTEXARRAYOBJECT_H
\inmodule QtCore
Definition qobject.h:103
The QOpenGLVertexArrayObject::Binder class is a convenience class to help with the binding and releas...
~Binder()
Destroys the QOpenGLVertexArrayObject::Binder and releases the associated vertex array object.
void release()
Can be used to temporarily release the associated vertex array object.
Binder(QOpenGLVertexArrayObject *v)
Creates a QOpenGLVertexArrayObject::Binder object and binds v by calling QOpenGLVertexArrayObject::bi...
void rebind()
Can be used to rebind the associated vertex array object.
The QOpenGLVertexArrayObject class wraps an OpenGL Vertex Array Object.
Combined button and popup list for selecting options.
GLsizei const GLfloat * v
[13]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define GLuint
#define Q_OBJECT
#define Q_PRIVATE_SLOT(d, signature)
sem release()
socketLayer bind(QHostAddress::Any, 4000)
view create()