index.js
function(shader) {
		var gl = this.gl;

		var offset = 0;
		var stride = this.vertexStride;

		//bind and update our vertex data before binding attributes
		this._updateBuffers();

		//for each attribtue
		for (var i=0; i<this._vertexAttribs.length; i++) {
			var a = this._vertexAttribs[i];

			//location of the attribute
			var loc = a.location === null 
					? shader.getAttributeLocation(a.name)
					: a.location;

			//TODO: We may want to skip unfound attribs
			// if (loc!==0 && !loc)
			// 	console.warn("WARN:", a.name, "is not enabled");

			//first, enable the vertex array
			gl.enableVertexAttribArray(loc);

			//then specify our vertex format
			gl.vertexAttribPointer(loc, a.numComponents, a.type || gl.FLOAT, 
								   a.normalize, stride, offset);

			//and increase the offset...
			offset += a.offsetCount * 4; //in bytes
		}
	}
function(shader) {
		var gl = this.gl;

		var offset = 0;
		var stride = this.vertexStride;

		//bind and update our vertex data before binding attributes
		this._updateBuffers();

		//for each attribtue
		for (var i=0; i<this._vertexAttribs.length; i++) {
			var a = this._vertexAttribs[i];

			//location of the attribute
			var loc = a.location === null 
					? shader.getAttributeLocation(a.name)
					: a.location;

			//TODO: We may want to skip unfound attribs
			// if (loc!==0 && !loc)
			// 	console.warn("WARN:", a.name, "is not enabled");

			//first, enable the vertex array
			gl.enableVertexAttribArray(loc);

			//then specify our vertex format
			gl.vertexAttribPointer(loc, a.numComponents, a.type || gl.FLOAT, 
								   a.normalize, stride, offset);

			//and increase the offset...
			offset += a.offsetCount * 4; //in bytes
		}
	}
function ( shader ) { var gl = this . gl ; var offset = 0 ; var stride = this . vertexStride ; //bind and update our vertex data before binding attributes this . _updateBuffers ( ) ; //for each attribtue for ( var i = 0 ; i < this . _vertexAttribs . length ; i ++ ) { var a = this . _vertexAttribs [ i ] ; //location of the attribute var loc = a . location === null ? shader . getAttributeLocation ( a . name ) : a . location ; //TODO: We may want to skip unfound attribs // if (loc!==0 && !loc) // 	console.warn("WARN:", a.name, "is not enabled"); //first, enable the vertex array gl . enableVertexAttribArray ( loc ) ; //then specify our vertex format gl . vertexAttribPointer ( loc , a . numComponents , a . type || gl . FLOAT , a . normalize , stride , offset ) ; //and increase the offset... offset += a . offsetCount * 4 ; //in bytes } }
binds this mesh's vertex attributes for the given shader
binds this mesh s vertex attributes for the given shader