I have leanred how to make a particle system through the NeHe example (By the way, I have converted the tutorial to GLUT version, so if anyone wants the GLUT source code I can give it to you, send me and email). Anyway, The particle system works great, but for the first few moments of the program the particles seem to come in bursts instead of as a continuous wave. ill post the code
glDisable(GL_LIGHTING);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, texture[2]);
for(loop = 0; loop < MAX_PARTICLES; loop++){
if(particle[loop].life <= 0.0){
particle[loop].active = 1;
particle[loop].life = 1.0;
particle[loop].fade = (rand()%10)/1000.0 + 0.04;
particle[loop].x = marble.x;
particle[loop].y = marble.y;
particle[loop].z = marble.z;
particle[loop].xi = (rand()%60)-30.0;
particle[loop].yi = (rand()%60)-30.0;
particle[loop].zi = (rand()%60)-30.0;
if(marble.xi > 0.0){
particle[loop].xg = -5.0;
}
if(marble.xi < 0.0){
particle[loop].xg = 5.0;
}
else{
particle[loop].xg = 0.0;
}
}
if(particle[loop].active == 1){
glColor4f(1.0, 0.5, 0.0, particle[loop].life);
x = particle[loop].x;
y = particle[loop].y;
z = particle[loop].z - 5.0;
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(x-0.05, y-0.05, z);
glTexCoord2f(0.0, 1.0); glVertex3f(x-0.05, y+0.05, z);
glTexCoord2f(1.0, 1.0); glVertex3f(x+0.05, y+0.05, z);
glTexCoord2f(1.0, 0.0); glVertex3f(x+0.05, y-0.05, z);
glEnd();
particle[loop].x += particle[loop].xi/3000;
particle[loop].y += particle[loop].yi/3000;
particle[loop].y += particle[loop].zi/3000;
particle[loop].xi += particle[loop].xg;
particle[loop].yi += particle[loop].yg;
particle[loop].zi += particle[loop].zg;
particle[loop].life -= particle[loop].fade;
}
}
glEnable(GL_LIGHTING);
sorry for the crappy formatting. Can some1 tell me how to get the particles to act uniformly and not burst in thebeginning and only later to flow continuously.