ParticleSphereGPU sample -> How do I draw lines instead of points


#1

Hey there,

I am currently playing around with the ParticleSphereGPU sample (cinder 0.9.1_mac), trying to learn GLSL.
My Question is, how I go about drawing a line for every particle, from position to pposition (previous position) instead of just a point at position.

Thanks in advance!


#2

Hi,

to start, change the primitive type from GL_POINTS to GL_LINES. You then need to supply 2 vertices per line, instead of 1 vertex per point. That’s all :slight_smile:

To learn more about OpenGL primitives and how to supply vertex data, see this link.

-Paul


#3

Hi,

I would use a geometry shader to generate a line segment from the current and the previous position attributes.

-Gabor