index.js
function Mesh(context, isStatic, numVerts, numIndices, vertexAttribs) {
		//TODO: use options here...
		if (!numVerts)
			throw "numVerts not specified, must be > 0";

		BaseObject.call(this, context);

		this.gl = this.context.gl;
		
		this.numVerts = null;
		this.numIndices = null;
		
		this.vertices = null;
		this.indices = null;
		this.vertexBuffer = null;
		this.indexBuffer = null;

		this.verticesDirty = true;
		this.indicesDirty = true;
		this.indexUsage = null;
		this.vertexUsage = null;

		/** 
		 * @property
		 * @private
		 */
		this._vertexAttribs = null;

		/** 
		 * The stride for one vertex _in bytes_. 
		 * 
		 * @property {Number} vertexStride
		 */
		this.vertexStride = null;

		this.numVerts = numVerts;
		this.numIndices = numIndices || 0;
		this.vertexUsage = isStatic ? this.gl.STATIC_DRAW : this.gl.DYNAMIC_DRAW;
		this.indexUsage  = isStatic ? this.gl.STATIC_DRAW : this.gl.DYNAMIC_DRAW;
		this._vertexAttribs = vertexAttribs || [];
		
		this.indicesDirty = true;
		this.verticesDirty = true;

		//determine the vertex stride based on given attributes
		var totalNumComponents = 0;
		for (var i=0; i<this._vertexAttribs.length; i++)
			totalNumComponents += this._vertexAttribs[i].offsetCount;
		this.vertexStride = totalNumComponents * 4; // in bytes

		this.vertices = new Float32Array(this.numVerts);
		this.indices = new Uint16Array(this.numIndices);

		//add this VBO to the managed cache
		this.context.addManagedObject(this);

		this.create();
	}
function Mesh(context, isStatic, numVerts, numIndices, vertexAttribs) {
		//TODO: use options here...
		if (!numVerts)
			throw "numVerts not specified, must be > 0";

		BaseObject.call(this, context);

		this.gl = this.context.gl;
		
		this.numVerts = null;
		this.numIndices = null;
		
		this.vertices = null;
		this.indices = null;
		this.vertexBuffer = null;
		this.indexBuffer = null;

		this.verticesDirty = true;
		this.indicesDirty = true;
		this.indexUsage = null;
		this.vertexUsage = null;

		/** 
		 * @property
		 * @private
		 */
		this._vertexAttribs = null;

		/** 
		 * The stride for one vertex _in bytes_. 
		 * 
		 * @property {Number} vertexStride
		 */
		this.vertexStride = null;

		this.numVerts = numVerts;
		this.numIndices = numIndices || 0;
		this.vertexUsage = isStatic ? this.gl.STATIC_DRAW : this.gl.DYNAMIC_DRAW;
		this.indexUsage  = isStatic ? this.gl.STATIC_DRAW : this.gl.DYNAMIC_DRAW;
		this._vertexAttribs = vertexAttribs || [];
		
		this.indicesDirty = true;
		this.verticesDirty = true;

		//determine the vertex stride based on given attributes
		var totalNumComponents = 0;
		for (var i=0; i<this._vertexAttribs.length; i++)
			totalNumComponents += this._vertexAttribs[i].offsetCount;
		this.vertexStride = totalNumComponents * 4; // in bytes

		this.vertices = new Float32Array(this.numVerts);
		this.indices = new Uint16Array(this.numIndices);

		//add this VBO to the managed cache
		this.context.addManagedObject(this);

		this.create();
	}
function Mesh ( context , isStatic , numVerts , numIndices , vertexAttribs ) { //TODO: use options here... if ( ! numVerts ) throw "numVerts not specified, must be > 0" ; BaseObject . call ( this , context ) ; this . gl = this . context . gl ; this . numVerts = null ; this . numIndices = null ; this . vertices = null ; this . indices = null ; this . vertexBuffer = null ; this . indexBuffer = null ; this . verticesDirty = true ; this . indicesDirty = true ; this . indexUsage = null ; this . vertexUsage = null ; /** 
		 * @property
		 * @private
		 */ this . _vertexAttribs = null ; /** 
		 * The stride for one vertex _in bytes_. 
		 * 
		 * @property {Number} vertexStride
		 */ this . vertexStride = null ; this . numVerts = numVerts ; this . numIndices = numIndices || 0 ; this . vertexUsage = isStatic ? this . gl . STATIC_DRAW : this . gl . DYNAMIC_DRAW ; this . indexUsage = isStatic ? this . gl . STATIC_DRAW : this . gl . DYNAMIC_DRAW ; this . _vertexAttribs = vertexAttribs || [ ] ; this . indicesDirty = true ; this . verticesDirty = true ; //determine the vertex stride based on given attributes var totalNumComponents = 0 ; for ( var i = 0 ; i < this . _vertexAttribs . length ; i ++ ) totalNumComponents += this . _vertexAttribs [ i ] . offsetCount ; this . vertexStride = totalNumComponents * 4 ; // in bytes this . vertices = new Float32Array ( this . numVerts ) ; this . indices = new Uint16Array ( this . numIndices ) ; //add this VBO to the managed cache this . context . addManagedObject ( this ) ; this . create ( ) ; }
Creates a new Mesh with the provided parameters.

If numIndices is 0 or falsy, no index buffer will be used
and indices will be an empty ArrayBuffer and a null indexBuffer.

If isStatic is true, then vertexUsage and indexUsage will
be set to gl.STATIC_DRAW. Otherwise they will use gl.DYNAMIC_DRAW.
You may want to adjust these after initialization for further control.

@param  {WebGLContext}  context the context for management
@param  {Boolean} isStatic      a hint as to whether this geometry is static
@param  {[type]}  numVerts      [description]
@param  {[type]}  numIndices    [description]
@param  {[type]}  vertexAttribs [description]
@return {[type]}                [description]
Creates a new Mesh with the provided parameters .