WebGL vertex array object wrapper/polyfill
var shell =var createBuffer =var createVAO =var glslify =var createShader =var vao shadershellshell
Assuming everything worked, here is what it should look like:
npm install gl-vao
var createVAO =
Creates a vertex array object
gl is the gl context in which the vertex array object is created
attributes is an array of objects that give the attributes bound to particular locations starting at 0. Each of these attributes is either an array-like object of length 4 or less representing a constant attribute value, or else it is an object with the following properties that correspond to the parameters passed to
gl-bufferobject encoding a webgl buffer
sizethe size of the attribute (default 4)
typethe type of the attribute (default
normalizeda flag that checks whether the attribute should be normalized or not
stridethe stride of the attribute in bytes (default 0)
offsetoffset to the start of the attribute in the buffer in bytes (default 0)
elements is a buffer created using
gl-buffer encoding the state of the vertex elements
elementsType the type of data contained within the element buffer, if given. Defaults to
gl.UNSIGNED_SHORT. Acceptable values are
gl.UNSIGNED_SHORT. If the
OES_element_index_uint extension is available and active,
gl.UNSIGNED_INT may also be used.
Binds the vertex array object to the active vertex state.
Unbinds the vertex array object.
Note You should call this method before switching back to using vertex arrays and buffers as usual. Failing to do so can cause the state of the vertex array object to become corrupted. However, it is acceptable to skip the unbind step if another vertex array object is immediately bound.
Draws the vertex array object.
modeis the mode to use when drawing the buffer, for example
countis the number of vertices to draw.
offsetis the offset to start drawing from. Default
Updates the contents of the vertex array object using the same syntax and conventions as the constructor.
Destroys the vertex array object and releases all of its resources.
(c) 2013 Mikola Lysenko. MIT License