QOpenGLVertexArrayObject::Binder Class

class QOpenGLVertexArrayObject::Binder

QOpenGLVertexArrayObject::Binder 类是一个便利类,用于帮助绑定和释放 OpenGL 顶点阵列对象。更多

注意:该类中的所有函数都是可重入的

公共函数

Binder(QOpenGLVertexArrayObject *v)
~Binder()
void rebind()
void release()

详细说明

QOpenGLVertexArrayObject::Binder 是一个简单的便利类,可用于协助绑定和释放 实例。该类与 的关系就像 与 的关系一样。QOpenGLVertexArrayObject QOpenGLVertexArrayObject QMutexLocker QMutex

该类实现了 RAII 原则,有助于确保复杂代码或出现异常时的行为。

该类的构造函数接受QOpenGLVertexArrayObject (VAO) 作为参数,并尝试绑定 VAO,必要时调用QOpenGLVertexArrayObject::create() 。该类的析构函数会调用QOpenGLVertexArrayObject::release() 来解除 VAO 的绑定。

如有需要,可使用release() 函数暂时解除 VAO 的绑定,然后再使用rebind() 重新绑定。

另请参阅 QOpenGLVertexArrayObject

成员函数文档

Binder::Binder(QOpenGLVertexArrayObject *v)

创建QOpenGLVertexArrayObject::Binder 对象,并通过调用QOpenGLVertexArrayObject::bind() 绑定v 。如有必要,它会首先调用QOpenGLVertexArrayObject::create().

[noexcept] Binder::~Binder()

销毁QOpenGLVertexArrayObject::Binder 并释放相关顶点数组对象。

void Binder::rebind()

可用于重新绑定相关的顶点数组对象。

另请参阅 release().

void Binder::release()

可用于临时释放相关顶点阵列对象。

另请参见 rebind().

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.