comparison src/modules/graphics/opengl/ParticleSystem.cpp @ 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 107d80a59bca
children 923a594c28d1
comparison
equal deleted inserted replaced
1442:d732e302eae6 1443:e952fc68069d
512 if (sprite == 0) return; // just in case of failure 512 if (sprite == 0) return; // just in case of failure
513 513
514 int numParticles = count(); 514 int numParticles = count();
515 if (numParticles == 0) return; // don't bother if there's nothing to do 515 if (numParticles == 0) return; // don't bother if there's nothing to do
516 516
517 Color curcolor = opengl::getCurrentColor();
518
517 glPushMatrix(); 519 glPushMatrix();
518 glPushAttrib(GL_CURRENT_BIT);
519 520
520 static Matrix t; 521 static Matrix t;
521 t.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky); 522 t.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
522 glMultMatrixf((const GLfloat *)t.getElements()); 523 glMultMatrixf((const GLfloat *)t.getElements());
523 524
574 575
575 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 576 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
576 glDisableClientState(GL_VERTEX_ARRAY); 577 glDisableClientState(GL_VERTEX_ARRAY);
577 glDisableClientState(GL_COLOR_ARRAY); 578 glDisableClientState(GL_COLOR_ARRAY);
578 579
579 glPopAttrib();
580 glPopMatrix(); 580 glPopMatrix();
581
582 opengl::setCurrentColor(curcolor);
581 } 583 }
582 584
583 void ParticleSystem::update(float dt) 585 void ParticleSystem::update(float dt)
584 { 586 {
585 // Traverse all particles and update. 587 // Traverse all particles and update.