"use strict" var bindAttribs = require("./do-bind.js") function VAOEmulated(gl) { this.gl = gl this._elements = null this._attributes = null this._elementsType = gl.UNSIGNED_SHORT } VAOEmulated.prototype.bind = function() { bindAttribs(this.gl, this._elements, this._attributes) } VAOEmulated.prototype.update = function(attributes, elements, elementsType) { this._elements = elements this._attributes = attributes this._elementsType = elementsType || this.gl.UNSIGNED_SHORT } VAOEmulated.prototype.dispose = function() { } VAOEmulated.prototype.unbind = function() { } VAOEmulated.prototype.draw = function(mode, count, offset) { offset = offset || 0 var gl = this.gl if(this._elements) { gl.drawElements(mode, count, this._elementsType, offset) } else { gl.drawArrays(mode, offset, count) } } function createVAOEmulated(gl) { return new VAOEmulated(gl) } module.exports = createVAOEmulated