Hey all, just wondering what your opinion is on this. In my app (which i've posted here) I have some particles that leave trails behind them as they move. The trails are basically points with lines between them, where each point has a variable that slowly decays until the point is deemed (old) and removed from the arraylist. I draw the lines between the points with line(), and I also tried doing it with BeginShape/EndShape and GL_BEGIN, etc, but invariably drawing lines seems to be ridiculously slow. When there are a lot of objects on screen it really lags, if I turn off the trails I can have many times more of the particles on screen, not to mention the particles are circles which should make them pretty expensive as well. I find it hard to believe Processing can do 3d graphics and even shaders and convolution effects, but can't draw lines without falling over.
Am I approaching this wrong or is drawing lines just really expensive? I'm at the point of just taking out the trails completely.
Drawing lines is expensive.. video cards just don't do them well as it's not often hardware accelerated from what I understand. It's got nothing to do with Processing - it's an OpenGL / Graphics card thing. Now you can certainly improve performance of lines by stuffing them into a VBO or something, but still, it will not be equal to points or quads. I could run 500,000 textured point sprites and my box would be fine, but 10,000 lines brings it to a crawl. If you figure out any magic, let me know. I did some research and there are some posts out there on volumetric lines that looked promising.