Page 3 of 3

Re: Particle System bugs

Posted: Sun Jun 20, 2010 4:30 pm
by K-Bal
The most effective way to do so is using a shader to update the particle positions. This way you don't have to transfer data through the bus, but it's also relatively complex. I could help you, though.

If you don't want to do this, try to use glDrawArrays on your raw data instead using a VBO and tell us if it is faster:

Code: Select all

glVertexPointer(3, GL_FLOAT, 0, &pos);

Re: Particle System bugs

Posted: Mon Jun 21, 2010 11:38 am
by mv2112
K-Bal wrote:The most effective way to do so is using a shader to update the particle positions. This way you don't have to transfer data through the bus, but it's also relatively complex. I could help you, though.

If you don't want to do this, try to use glDrawArrays on your raw data instead using a VBO and tell us if it is faster:

Code: Select all

glVertexPointer(3, GL_FLOAT, 0, &pos);
I ended up re-writing my particle system, but this time with openGL in mind. It now runs REALLY FAST with 100,000 particles! My old particle system code was trash, the new code is shiny and clean! It does run faster with the VBO, rather than with just raw data.

Re: Particle System bugs

Posted: Mon Jun 21, 2010 2:12 pm
by mv2112
http://www.youtube.com/watch?v=ZxrKP1GQdxU
Here is a little demo i made

Re: Particle System bugs

Posted: Tue Jun 22, 2010 11:58 am
by GroundUpEngine
mv2112 wrote:http://www.youtube.com/watch?v=ZxrKP1GQdxU
Here is a little demo i made
Nice work! VBO's pwn :)

Re: Particle System bugs

Posted: Tue Jun 22, 2010 12:58 pm
by mv2112
GroundUpEngine wrote:
mv2112 wrote:http://www.youtube.com/watch?v=ZxrKP1GQdxU
Here is a little demo i made
Nice work! VBO's pwn :)
Thanks! 0_o

Does anyone know any good ways of controlling the particles? Like how to get the particles to emit from a point in a circle, algorithms, and stuff like that?

Re: Particle System bugs

Posted: Tue Jun 22, 2010 2:12 pm
by Bakkon
Your particles seem to be making a square shape instead of circular. Try normalizing the direction vector.

Re: Particle System bugs

Posted: Wed Jun 23, 2010 2:05 pm
by mv2112
Bakkon wrote:Your particles seem to be making a square shape instead of circular. Try normalizing the direction vector.
Thats the thing, im just generating random offsets to make the particles move the way they are, im looking for an efficient way of making them go in a circle, i have no circle algorithm type thing...

Re: Particle System bugs

Posted: Wed Jun 23, 2010 5:31 pm
by avansc
not tested, but im sure this will do something like that.

Code: Select all

vel =  rand()%MAX_VEL;
float ang = rand()%360;
ang /= 180*PI;
x_vel = vel*cos(ang);
y_vel = vel*sin(ang);
not efficient, but just a start.