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
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
14QT_BEGIN_NAMESPACE
15
16class QOpenGLVertexArrayObjectPrivate;
17
18class Q_OPENGL_EXPORT QOpenGLVertexArrayObject : public QObject
19{
20 Q_OBJECT
21
22public:
23 explicit QOpenGLVertexArrayObject(QObject* parent = nullptr);
24 ~QOpenGLVertexArrayObject();
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:
36 inline Binder(QOpenGLVertexArrayObject *v)
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)
61 QOpenGLVertexArrayObject *vao;
62 };
63
64private:
65 Q_DISABLE_COPY(QOpenGLVertexArrayObject)
66 Q_DECLARE_PRIVATE(QOpenGLVertexArrayObject)
67 Q_PRIVATE_SLOT(d_func(), void _q_contextAboutToBeDestroyed())
68 QOpenGLVertexArrayObject(QOpenGLVertexArrayObjectPrivate &dd);
69};
70
71QT_END_NAMESPACE
72
73#endif
74
75#endif // QOPENGLVERTEXARRAYOBJECT_H
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:13
constexpr int qRed(QRgb rgb)
Definition qrgb.h:18
constexpr int qGreen(QRgb rgb)
Definition qrgb.h:21
constexpr QRgb qRgba(int r, int g, int b, int a)
Definition qrgb.h:33
constexpr int qBlue(QRgb rgb)
Definition qrgb.h:24
constexpr int qAlpha(QRgb rgb)
Definition qrgb.h:27