OES_vertex_array_object
WebGL working group (public_webgl 'at' khronos.org)
Members of the WebGL working group
Last modified date: July 09, 2022
Revision: 12
WebGL extension #5
Written against the WebGL API 1.0 specification.
Promoted to core and no longer available as an extension in WebGL API 2.0 specification.
This extension exposes the OES_vertex_array_object functionality to WebGL.
There are no WebGL-specific behavioral changes.
Consult the above extension for documentation, issues and new functions and enumerants.
[Exposed=(Window,Worker), LegacyNoInterfaceObject] interface WebGLVertexArrayObjectOES : WebGLObject { }; [Exposed=(Window,Worker), LegacyNoInterfaceObject] interface OES_vertex_array_object { const GLenum VERTEX_ARRAY_BINDING_OES = 0x85B5; WebGLVertexArrayObjectOES? createVertexArrayOES(); undefined deleteVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); [WebGLHandlesContextLoss] GLboolean isVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); undefined bindVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); };
WebGLVertexArrayObjectOES
object
and initialize it with a vertex array object name as if by
calling glGenVertexArraysOES
.
If arrayObject
was generated by a different
WebGLRenderingContext
than this one, generates
an INVALID_OPERATION
error.
Mark for deletion the vertex array object contained in the
passed arrayObject
, as if by calling
glDeleteVertexArraysOES
.
If the object has already been marked for deletion, the call has no effect. Note that underlying GL object will be automatically marked for deletion when the JS object is destroyed, however this method allows authors to mark an object for deletion early.
Returns true if the passed arrayObject
is valid and false otherwise.
Returns false if the vertex array was generated by a different
WebGLRenderingContext
than this one.
Returns false if the vertex array's invalidated flag is set.
If arrayObject
was generated by a different
WebGLRenderingContext
than this one, generates
an INVALID_OPERATION
error.
Bind the given WebGLVertexArrayObjectOES
object.
If arrayObject
is null, the default vertex array
provided by the context is bound. An attempt to bind a deleted
vertex array will generate a INVALID_OPERATION
error,
and the current binding will remain untouched.
The OES_vertex_array_object spec does not make it clear what happens to buffers that are deleted when they are referenced by vertex array objects. It is inferred that all buffers are reference counted.
Before OES_vertex_array_object there was no way to use a deleted buffer in a single context as the spec states it would be unbound from all bind points. After OES_vertex_array_object it is now possible to use deleted buffers.
Furthermore, the OpenGL ES 2.0 spec specifies that using a deleted buffer has undefined results including possibly corrupt rendering and generating GL errors. Undefined behavior is unacceptable for WebGL.
RESOLVED: Buffers should be reference counted when attached to a vertex array object. This is consistent with the OpenGL ES 3.0 spec's implementation of Vertex Array Objects and matches the behavior of other WebGL objects, such as textures that are attached to framebuffers.
This will require that most implementations do not call glDeleteBuffer when the user calls deleteBuffer on the WebGL context. Instead the implementation must wait for all references to be released before calling glDeleteBuffer to prevent undefined behavior.
If a buffer object is deleted while it is attached to the currently bound vertex array object, then it is as if BindBuffer had been called, with a buffer of 0, for each target to which this buffer was attached in the currently bound vertex array object. In other words, this buffer is first detached from all attachment points in the currently bound vertex array object. Note that the buffer is specifically not detached from any other vertex array object. Detaching the buffer from any other vertex array objects is the responsibility of the application.
Revision 1, 2011/01/27
Revision 2, 2011/11/12
Revision 3, 2011/12/06
Revision 4, 2011/12/07
Revision 5, 2012/01/03
Revision 6, 2012/09/24
Revision 7, 2012/10/16
Revision 8, 2013/05/08
Revision 9, 2013/05/14
Revision 10, 2013/05/15
Revision 11, 2014/07/15
Revision 12, 2022/07/09