Skip to content

Commit

Permalink
Merge pull request #3126 from lilleyse/vertexDivisorFix
Browse files Browse the repository at this point in the history
Fixed divisor issue
  • Loading branch information
pjcozzi committed Oct 26, 2015
2 parents f5ed115 + 4d2bf7f commit c2649d8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Source/Renderer/VertexArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,18 @@ define([
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer._getBuffer());
gl.vertexAttribPointer(index, this.componentsPerAttribute, this.componentDatatype, this.normalize, this.strideInBytes, this.offsetInBytes);
gl.enableVertexAttribArray(index);
if (this.instanceDivisor > 0) {
context.glVertexAttribDivisor(index, this.instanceDivisor);
context._vertexAttribDivisors[index] = this.instanceDivisor;
context._previousDrawInstanced = true;
}
};

attr.disableVertexAttribArray = function(gl) {
gl.disableVertexAttribArray(this.index);
if (this.instanceDivisor > 0) {
context.glVertexAttribDivisor(index, 0);
}
};
} else {
// Less common case: value array for the same data for each vertex
Expand Down Expand Up @@ -707,13 +715,12 @@ define([
VertexArray.prototype._bind = function() {
if (defined(this._vao)) {
this._context.glBindVertexArray(this._vao);
if (this._context.instancedArrays) {
setVertexAttribDivisor(this);
}
} else {
bind(this._gl, this._attributes, this._indexBuffer);
}

if (this._context.instancedArrays) {
setVertexAttribDivisor(this);
}
};

VertexArray.prototype._unBind = function() {
Expand Down

0 comments on commit c2649d8

Please sign in to comment.