Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QOPENGLVERTEXARRAYOBJECT_H
6#define QOPENGLVERTEXARRAYOBJECT_H
7
8#include <QtOpenGL/qtopenglglobal.h>
9
10#ifndef QT_NO_OPENGL
11
12#include <QtCore/QObject>
13#include <QtGui/qopengl.h>
14
15QT_BEGIN_NAMESPACE
16
17class QOpenGLVertexArrayObjectPrivate;
18
19class Q_OPENGL_EXPORT QOpenGLVertexArrayObject : public QObject
20{
21 Q_OBJECT
22
23public:
24 explicit QOpenGLVertexArrayObject(QObject* parent = nullptr);
25 ~QOpenGLVertexArrayObject();
26
27 bool create();
28 void destroy();
29 bool isCreated() const;
30 GLuint objectId() const;
31 void bind();
32 void release();
33
34 class Binder
35 {
36 public:
37 inline Binder(QOpenGLVertexArrayObject *v)
38 : vao(v)
39 {
40 Q_ASSERT(v);
41 if (vao->isCreated() || vao->create())
42 vao->bind();
43 }
44
45 inline ~Binder()
46 {
47 release();
48 }
49
50 inline void release()
51 {
52 vao->release();
53 }
54
55 inline void rebind()
56 {
57 vao->bind();
58 }
59
60 private:
61 Q_DISABLE_COPY(Binder)
62 QOpenGLVertexArrayObject *vao;
63 };
64
65private:
66 Q_DISABLE_COPY(QOpenGLVertexArrayObject)
67 Q_DECLARE_PRIVATE(QOpenGLVertexArrayObject)
68 Q_PRIVATE_SLOT(d_func(), void _q_contextAboutToBeDestroyed())
69 QOpenGLVertexArrayObject(QOpenGLVertexArrayObjectPrivate &dd);
70};
71
72QT_END_NAMESPACE
73
74#endif
75
76#endif // QOPENGLVERTEXARRAYOBJECT_H
The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API.
void freeResource(QOpenGLContext *context) override
QOpenGLGlyphTexture(QOpenGLContext *ctx)
The QOpenGLVertexArrayObject class wraps an OpenGL Vertex Array Object.
Combined button and popup list for selecting options.
static void load_glyph_image_region_to_texture(QOpenGLContext *ctx, const QImage &srcImg, int x, int y, int w, int h, GLuint texture, int tx, int ty)
static void load_glyph_image_to_texture(QOpenGLContext *ctx, QImage &img, GLuint texture, int tx, int ty)
static QT_BEGIN_NAMESPACE int next_qopengltextureglyphcache_serial_number()
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition qrgb.h:14
constexpr int qRed(QRgb rgb)
Definition qrgb.h:19
constexpr int qGreen(QRgb rgb)
Definition qrgb.h:22
constexpr QRgb qRgba(int r, int g, int b, int a)
Definition qrgb.h:34
constexpr int qBlue(QRgb rgb)
Definition qrgb.h:25
constexpr int qAlpha(QRgb rgb)
Definition qrgb.h:28