Question

I am making some particle demo with openframeworks(v0.7.4 for iOS).

Sometimes I'd like to change their size by distance, and it works well with the code like below.

ofVboMesh mesh;
mesh.setMode(OF_PRIMITIVE_POINTS);
for(unsigned int i = 0; i < debris.size(); i++){
mesh.addVertex(debris[i]);
    mesh.addColor(color_debris[i]);
}
static GLfloat distance[] = { 0.0, 0.0, 1.0 };//------------------ set vec
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, distance);//---- set attenuation
glPointSize(40000);
mesh.draw();

But next time when another Particles are drawn, there's no need to change their size by distance. I want to cancel or initialize what I did with glPointParameterfv().

I guess this might be really primitive question, but cannot find way to do this.

Was it helpful?

Solution

Just set it back to the default values, which is 1.0, 0.0, 0.0. Alternatively you could also get the original values before you change them using something like glGetFloatv(GL_POINT_DISTANCE_ATTENUATION, oldDistance); and set it back to those after you are finished drawing your particles.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top