04-19-2005, 11:05 AM
I found this tutorial about a particle engine on NeHe, and I've tried to get it to work with FB, but there's some things that I don't know how to "translate" to FB...
Here we go:
and...
I guess the last one is something similiar to:
Right?
Particle Engine on NeHe http://nehe.gamedev.net/data/lessons/les...?lesson=19
Here we go:
Code:
int LoadGLTextures() // Load Bitmaps And Convert To Textures
{
int Status=FALSE; // Status Indicator
AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture
memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL
if (TextureImage[0]=LoadBMP("Data/Particle.bmp")) // Load Particle Texture
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(1, &texture[0]); // Create One Textures
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
}
if (TextureImage[0]) // If Texture Exists
{
if (TextureImage[0]->data) // If Texture Image Exists
{
free(TextureImage[0]->data); // Free The Texture Image Memory
}
free(TextureImage[0]); // Free The Image Structure
}
return Status; // Return The Status
}
and...
Code:
particle[loop].r=colors[loop*(12/MAX_PARTICLES)][0]; // Select Red Rainbow Color
particle[loop].g=colors[loop*(12/MAX_PARTICLES)][1]; // Select Red Rainbow Color
particle[loop].b=colors[loop*(12/MAX_PARTICLES)][2]; // Select Red Rainbow Color
Code:
particle[loop].fade=float(rand()%100)/1000.0f+0.003f; // Random Fade Speed
I guess the last one is something similiar to:
Code:
particle(i).fade = Int(Rnd * 100) / 1000 + 0.003
Particle Engine on NeHe http://nehe.gamedev.net/data/lessons/les...?lesson=19