Fixed Particle Renderer errors

This commit is contained in:
Felipe Alfonso 2017-01-17 22:51:33 -03:00
parent 9b18a8121a
commit 0715656d04
2 changed files with 6 additions and 4 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: 'bb3f6b90-dd1b-11e6-9f7f-6937ccaffca9'
build: '45162530-dd20-11e6-9516-fbf368a07f31'
};
module.exports = CHECKSUM;

View file

@ -86,10 +86,10 @@ ParticleRenderer.prototype.init = function ()
var vertexDataBuffer = new VertexBuffer(ParticleRenderer.VERTEX_SIZE * ParticleRenderer.PARTICLE_VERTEX_COUNT * ParticleRenderer.MAX_PARTICLES);
var indexDataBuffer = new IndexBuffer(ParticleRenderer.INDEX_SIZE * ParticleRenderer.PARTICLE_INDEX_COUNT * ParticleRenderer.MAX_PARTICLES);
var vertShader = CreateShader(gl, ParticleRenderer.VERTEX_SHADER_SOURCE, gl.VERTEX_SHADER);
var fragShader = CreateShader(gl, ParticleRenderer.FRAGMENT_SHADER_SOURCE, gl.FRAGMENT_SHADER_SOURCE);
var fragShader = CreateShader(gl, ParticleRenderer.FRAGMENT_SHADER_SOURCE, gl.FRAGMENT_SHADER);
var program = CreateProgram(gl, vertShader, fragShader);
var indexBufferObject = CreateBuffer(gl, gl.ELEMENT_ARRAY_BUFFER, gl.STATIC_DRAW, null, indexDataBuffer.getByteCapacity());
var vertexArray = new VertexArray(gl,
var vertexArray = new VertexArray(
CreateBuffer(gl, gl.ARRAY_BUFFER, gl.STREAM_DRAW, null, vertexDataBuffer.getByteCapacity()),
[
CreateAttribDesc(gl, program, 'a_position', 2, gl.FLOAT, false, ParticleRenderer.VERTEX_SIZE, 0),
@ -124,7 +124,9 @@ ParticleRenderer.prototype.init = function ()
indexBuffer[indexA + 4] = indexB + 2;
indexBuffer[indexA + 5] = indexB + 3;
}
this.bind();
this.resize(this.width, this.height);
this.unbind();
}
else
{
@ -208,7 +210,7 @@ ParticleRenderer.prototype.bind = function ()
gl.enable(gl.BLEND);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBufferObject);
BindVertexArray(this.vertexArray);
BindVertexArray(gl, this.vertexArray);
};
ParticleRenderer.prototype.unbind = function ()