Prevent redundant glBindBuffer calls.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-10-20 21:50:48 -03:00
parent 4c122e6581
commit d1c5edd792
14 changed files with 128 additions and 160 deletions
@@ -137,6 +137,7 @@ void ParticleSystem::draw(const Matrix4 &m)
gl.useVertexAttribArrays(ATTRIBFLAG_POS | ATTRIBFLAG_TEXCOORD | ATTRIBFLAG_COLOR);
gl.bindBuffer(BUFFER_VERTEX, 0);
glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), &particleVerts[0].r);
glVertexAttribPointer(ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), &particleVerts[0].x);
glVertexAttribPointer(ATTRIB_TEXCOORD, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), &particleVerts[0].s);
@@ -148,6 +149,7 @@ void ParticleSystem::draw(const Matrix4 &m)
// at least one graphics driver (the one for Kepler nvidia GPUs in OS X
// 10.11) fails to render geometry if an index buffer is used with
// client-side vertex arrays.
gl.bindBuffer(BUFFER_INDEX, 0);
gl.drawElements(GL_TRIANGLES, count, gltype, quadIndices.getIndices(0));
}