Mercurial > love-experiments
changeset 1443:e952fc68069d
Ensure the current color is set properly after drawing particlesystems and spritebatches
| author | Alex Szpakowski <slime73@gmail.com> |
|---|---|
| date | Fri, 12 Apr 2013 15:40:53 -0300 |
| parents | d732e302eae6 |
| children | 6975bf64c459 |
| files | src/modules/graphics/opengl/ParticleSystem.cpp src/modules/graphics/opengl/SpriteBatch.cpp |
| diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/modules/graphics/opengl/ParticleSystem.cpp Fri Apr 12 15:24:21 2013 -0300 +++ b/src/modules/graphics/opengl/ParticleSystem.cpp Fri Apr 12 15:40:53 2013 -0300 @@ -514,8 +514,9 @@ int numParticles = count(); if (numParticles == 0) return; // don't bother if there's nothing to do + Color curcolor = opengl::getCurrentColor(); + glPushMatrix(); - glPushAttrib(GL_CURRENT_BIT); static Matrix t; t.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky); @@ -576,8 +577,9 @@ glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); - glPopAttrib(); glPopMatrix(); + + opengl::setCurrentColor(curcolor); } void ParticleSystem::update(float dt)
--- a/src/modules/graphics/opengl/SpriteBatch.cpp Fri Apr 12 15:24:21 2013 -0300 +++ b/src/modules/graphics/opengl/SpriteBatch.cpp Fri Apr 12 15:40:53 2013 -0300 @@ -218,6 +218,8 @@ VertexBuffer::Bind array_bind(*array_buf); VertexBuffer::Bind element_bind(*element_buf->getVertexBuffer()); + Color curcolor = opengl::getCurrentColor(); + // Apply per-sprite color, if a color is set. if (color) { @@ -237,7 +239,10 @@ glDisableClientState(GL_TEXTURE_COORD_ARRAY); if (color) + { glDisableClientState(GL_COLOR_ARRAY); + opengl::setCurrentColor(curcolor); + } glPopMatrix(); }
