I have a simple particle effect in OpenGL using GL_POINTS. The following is caused: particles are transferred in order from the particle farthest from the camera, first to the nearest camera:
void draw_particle(particle* part) {
static GLfloat quadratic[] = {0.005, 0.01, 1/600.0};
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic);
glPointSize(part->size);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SPRITE_ARB);
glEnable(GL_TEXTURE_2D);
glBegin(GL_POINTS);
glColor4f(part->r, part->g, part->b, part->a);
glVertex3f(part->pos_x, part->pos_y, part->pos_z);
glEnd();
glDisable(GL_BLEND);
glDisable(GL_POINT_SPRITE_ARB);
}
However, when rendering, there are some artifacts that can be seen in the following effect: artifact image http://img199.imageshack.us/img199/9574/particleeffect.png
Problems disappear if I turn off depth testing, but I need the effects to interact with other elements in the scene, appearing in front of and behind elements of the same GL_TRIANGLE_STRIP depending on the depth.
source
share