Binder 類

class QOpenGLVertexArrayObject ::Binder

The QOpenGLVertexArrayObject::Binder 類是有助於綁定和釋放 OpenGL 頂點數組對象的方便類。 更多...

該類在 Qt 5.1 引入。

注意: 此類的所有函數 可重入 .

公共函數

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

詳細描述

QOpenGLVertexArrayObject::Binder is a simple convenience class that can be used to assist with the binding and releasing of QOpenGLVertexArrayObject instances. This class is to QOpenGLVertexArrayObject as QMutexLocker is to QMutex .

This class implements the RAII principle which helps to ensure behavior in complex code or in the presence of exceptions.

The constructor of this class accepts a QOpenGLVertexArrayObject (VAO) as an argument and attempts to bind the VAO, calling QOpenGLVertexArrayObject::create () if necessary. The destructor of this class calls QOpenGLVertexArrayObject::release () which unbinds the VAO.

If needed the VAO can be temporarily unbound with the release () function and bound once more with rebind ().

另請參閱 QOpenGLVertexArrayObject .

成員函數文檔編製

Binder:: Binder ( QOpenGLVertexArrayObject * v )

創建 QOpenGLVertexArrayObject::Binder object and binds v 通過調用 QOpenGLVertexArrayObject::bind (). If necessary it first calls QOpenGLVertexArrayObject::create ().

Binder:: ~Binder ()

銷毀 QOpenGLVertexArrayObject::Binder and releases the associated vertex array object.

void Binder:: rebind ()

Can be used to rebind the associated vertex array object.

另請參閱 release ().

void Binder:: release ()

Can be used to temporarily release the associated vertex array object.

另請參閱 rebind ().