1. rude
  2. love

Commits

Alex Szpakowski  committed e952fc6

Ensure the current color is set properly after drawing particlesystems and spritebatches

  • Participants
  • Parent commits d732e30
  • Branches default

Comments (0)

Files changed (2)

File src/modules/graphics/opengl/ParticleSystem.cpp

View file
  • Ignore whitespace
 	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);
 	glDisableClientState(GL_VERTEX_ARRAY);
 	glDisableClientState(GL_COLOR_ARRAY);
 
-	glPopAttrib();
 	glPopMatrix();
+
+	opengl::setCurrentColor(curcolor);
 }
 
 void ParticleSystem::update(float dt)

File src/modules/graphics/opengl/SpriteBatch.cpp

View file
  • Ignore whitespace
 	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)
 	{
 	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 
 	if (color)
+	{
 		glDisableClientState(GL_COLOR_ARRAY);
+		opengl::setCurrentColor(curcolor);
+	}
 
 	glPopMatrix();
 }