Points: Discard or Clip Space

Hello :wave: :slight_smile:
Using WebGL 1 (OpenGL ES 2.0), I am making a particle pool with spritesheet animations with gl.POINTS. When necessary, the points are called to specific positions by the application, finish their lifetime and then disappear, becoming ready to be called again to a different position in the future.
My question is: What is the better way to make the point disappear?

  1. discard in Fragment Shader based on some attribute
  2. Move vertex outside of clip space, like gl_Position = vec4(1,1,1,0);

Which method is more efficient? Or maybe there is a better one?
Im not really sure how either of these two affects the pipeline/GPU, so Im humbly asking for help :bowing_man:

The second option is more efficient.

But if you don’t care about how points are indexed, another option is to replace the deleted point with the last point and decrement the count passed to glDrawArrays or glDrawElements.

1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.