Object constructor, requires a context and a valid identifier.
Valid context to create the object for.
Meaningful name for identification of this instance.
The feature specific bind function. This is mapped on initialization either to native VAO bind, extension based VAO bind or directly to the drawable's bind.
Flag to track one-time initialization (in case vertex arrays are supported).
Number of references to this object. If at least a single reference was counted, this object can neither be initialized (and thus created) nor uninitialized (and thus deleted). The reference count is controlled via ref() and unref() functions.
The feature specific unbind function. This is mapped on initialization either to native VAO unbind, extension based VAO unbind or directly to the drawable's unbind.
Asserts the objects initialization status to be true. Note that the implementation is cached and forwarded to either an empty function when initialized and to an acutal assert(false) otherwise.
Asserts the objects initialization status to be false. Note that the implementation is cached and forwarded to either an empty function when uninitialized and to an acutal assert(false) otherwise.
Default vertex array, e.g., used for unbind.
Read-only access to the objects context, used to get context information and WebGL API access.
Every GPU asset that allocates memory should provide a human readable identifier for GPU allocation tracking and debugging purposes. Please note that the identifier might changed on initialization due to the generation and assignment of a unique identifier.
Property getter for readonly access to the initialization status of an initializable instance.
Read-only access to the WebGL object handle.
Cached object status used to derive validity when initialized.
Invokes the preset bind function.
Depending on the context features, a vertex array object is created and the bind method is specified (either native, by extension, or none/direct bind).
Function that should bind all VBOs and IBOs required for drawing.
Function that should unbind all VBOs and IBOs used for drawing.
On deletion either the VAO is deleted (when VAOs are supported natively or by extension) or nothing happens. Note that the VAO does not own any of its associated buffers (which can be shared over multiple VAO instances or used directly).
Can be used to enforce rebinding all buffers, e.g., when data has changed.
Increment the reference count of this object.
Invokes the preset unbind function.
Decrement the reference count of this object.
Method decorator for asserting the initialization status of an initializable to be true.
Method decorator for asserting the initialization status of an initializable to be false.
Method decorator for discarding of Initializable inheritors. This decorator asserts the initialization
status of the instance that is to be discarded, invokes its uninitialization, and falsifies the
initialization status. In order to encourage the use of assertInitialized
and assertUninitialized
they are
dynamically bound to a static, always-failing assert and an empty/undefined function respectively.
Method decorator for initialization of Initializable inheritors. This decorator asserts the initialization status
of the instance that is to be initialized, invokes its initialization with arbitrary number of parameters,
and sets the initialization status to the initialization success (either false or true).
In order to encourage the use of assertInitialized
and assertUninitialized
they are dynamically
bound to either a static, always-failing assert or an empty/undefined function.
Method decorator for uninitialization of Initializable inheritors. This decorator asserts the initialization
status of the instance that is to be uninitialized, invokes its uninitialization, and falsifies the
initialization status. In order to encourage the use of assertInitialized
and assertUninitialized
they are
dynamically bound to a static, always-failing assert and an empty/undefined function respectively.
Wrapper for drawable objects by means of multiple vertex buffer that could be bound to a vertex array. If the context supports vertex array objects either natively (webgl2) or by extension, the drawable buffer are bound only once on initialization and only a single VAO bind and unbind is required for a rendering pass.
The VertexArray can be used wrapped around any VertexBuffer interface:
With that the screen-filling triangle can be drawn as follows: