Sign in to follow this  
ade-the-heat

bad explosion render sometimes-SOLVED

Recommended Posts

I use the same code and texture for explosions. Sometimes it looks correct and sometimes it looks bad - although its the same render func. good explosion: note the blurring and good looking to the particles http://myweb.tiscali.co.uk/3drocknroll/explodeblur.bmp the bad one is here: you can see it has the bounding quad surrounding each particle http://myweb.tiscali.co.uk/3drocknroll/explospoor.bmp So why would they look different and how do I get them looking like the first one ? Here's the render code:
void CExplosion::Render()
{
  //get model matrix 
  ...

  //save current color
  glPushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_LIGHTING_BIT);

  glDisable(GL_DEPTH_TEST);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
 
  glEnable(GL_TEXTURE_2D);
  glBindTexture(GL_TEXTURE_2D, m_texture);
  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

  glEnable(GL_COLOR_MATERIAL);


  glBegin(GL_QUADS);
  for (int i = 0; i < m_numParticles; ++i)
  {
    //get sizes etc, store in 'temp'

    //set color
    glColor4fv(m_particleList[i].m_color);

    glTexCoord2f(0.0, 0.0); 
    glVertex3f(temp.x,temp.y, temp.z);

    glTexCoord2f(1.0, 0.0); 
    glVertex3f(temp.x, temp.y, temp.z);

    glTexCoord2f(1.0, 1.0);
    glVertex3f(temp.x, temp.y, temp.z);

    glTexCoord2f(0.0, 1.0); 
    glVertex3f(temp.x, temp.y, temp.z);
  }
  glEnd();

  glDisable(GL_COLOR_MATERIAL);
  glDisable(GL_TEXTURE_2D);
  glDisable(GL_BLEND);
  glEnable(GL_DEPTH_TEST);
 
  glPopAttrib(); //reset color


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this