Hi, I’m trying to right a CUDA (and eventually OpenCL) based particle engine. I have the particles working, but I would like to have them blend additively. Here is my current rendering code:
void glDrawParticles (void) {
//GLfloat fSizes[2];
//GLGetFloatfv(GL_ALIASED_POINT_SIZE_RANGE, fSizes);
//if( fSizes[1] > 100.0f )
//fSizes[1] = 100.0f;
glPointSize( 4 );
glPushMatrix();
glEnable(GL_POINT_SPRITE);
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
glEnable (GL_BLEND);
glBlendFunc (GL_ONE, GL_ONE);
glBindTexture(GL_TEXTURE_2D, texture[1]);
glBegin(GL_POINTS);
for( int i = 0; i < ParticleCount; i++ )
{
glColor4f( Particle[i].Red,
Particle[i].Green,
Particle[i].Blue,
0.3f );
glVertex3f( Particle[i].p.x,
Particle[i].p.y,
Particle[i].p.z );
}
glEnd();
glPopMatrix();
}
It currently just draws them all the specified RGB color, (0.1,0.8,0.1). Shouldn’t it be turning brighter? Am I doing something wrong?
Thanks.