Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

iNsAn1tY

Absolute vs. Relative Co-ords...

This topic is 5959 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I'm writing a particle physics system, which is working very well, but I have sort of a niggling feeling I'm doing something wrong. When I render the particle, I take it's position, and create from it new vertices for the particle's onscreen appearance. This is how I render every particle at the moment (they're just basic polygons, until I sort everything else out):
  
glBegin(GL_QUADS);
    
    glVertex3f(Particle.Position[0], Particle.Position[1] + 1, Particle.Position[2] - 1);
    glVertex3f(Particle.Position[0], Particle.Position[1] - 1, Particle.Position[2] - 1);
    glVertex3f(Particle.Position[0], Particle.Position[1] - 1, Particle.Position[2] + 1);
    glVertex3f(Particle.Position[0], Particle.Position[1] + 1, Particle.Position[2] + 1);
    
glEnd();
  
Not only does it look terrible, I think there's a better method of doing it, but I'm not sure:
  
// Save current modelview matrix, start

// loop which runs through each particle...

 
// Reset modelview matrix...

glLoadIdentity();
 
// Move to position where particle should

// be rendered...

glTranslatef(Particle.Position[0], Particle.Position[1], Particle.Position[2]);
 
// Call display list to render particle...

  
The second method would allow me to create or load one particle design, say, some debris, and render it every time without having to modify the vertices. This is probably better, but would it be any faster than the other method I was using (creating new vertices every time, potentially requiring a lot of adding)? I'm thinking it probably would be for complex particle designs, like debris. This may seem trivial, but I think that the second method would be much better then the current one I'm using, and I'm trying to squeeze every last drop of power out of my system to make some brilliant effects. Anyway, thanks in advance for any replies...
Movie Quote of the Week:

I love the smell of napalm in the morning...
- Capt. Kilgore, Apocalypse Now.
Try http://uk.geocities.com/mentalmantle - DarkVertex Coming Soon! [edited by - iNsAn1tY on May 30, 2002 8:02:19 AM]

Share this post


Link to post
Share on other sites
Advertisement
>>glTranslatef(Particle.Position[0], Particle.Position[1], Particle.Position[2]);
// Call display list to render particle...
<<

dont have a dl for a particle

the best method is to first update ALL the particles positions/rotations
eg
lopp all particles
{
part.pos += part[i].vel;
}

and then draw them all in one hit
glDrawArrays(..)


http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!