PDA

View Full Version : Arraying 'Particles' around a sphere

plates
01-05-2002, 03:59 PM
GLvoid DrawParticle()
{
for(ploop=0;ploop<MAXPARTICLES;ploop++) // MAXPARTICLES = 10
{
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, bmptexture[11]); // Bind Texture 11

if (particle[ploop].active) // If the particle is active
{
glRotatef(rot, 0.0f, 0.0f, 1.0f); // Rot is Global Variable
glTranslatef(4.0f, 0.0f, 0.0f); // of type float declarded at 0.0f.

glColor4f(particle[ploop].r, particle[ploop].g, particle[ploop].b, particle[ploop].life);

glBegin(GL_TRIANGLE_STRIP); // DRaws a Triange Strip Quad
glTexCoord2d(1,1); glVertex3f( 0.5f, 0.5f, 0.0f); // Top Right
glTexCoord2d(0,1); glVertex3f(-0.5f, 0.5f, 0.0f); // Top Left
glTexCoord2d(1,0); glVertex3f( 0.5f,-0.5f, 0.0f); // Bottom Right
glTexCoord2d(0,0); glVertex3f(-0.5f,-0.5f, 0.0f); // Bottom Left
glEnd(); // Finished Drawing Triangle Strip Quad

}

rot = rot + 0.0052f; // Add 0.0052f to 'rot' variable
glPopMatrix();
}

}

Basically, I've got a sphere, and I'm trying to array these particles around it, to generate a short of halo effect. Problem is, when I do this, it just maps every 'particle' over the other, so I end up with a nasty white cube rotating around the sphere. I've incremented rot - as you can see, but it just dosen't work. I've written down the statements logicially and traced what I think to be the way they should draw the particles, but it dosen't seem to be working :\

Any help (Code specifially) greatly appericated

Thanks

plates.

nemesis
01-07-2002, 01:40 AM
Hello plates,

It seems as if all were correct...
Have you tried to rotate the particles a bigger angle?

-nemesis-