title: Simple particle system on Android using OpenGL ES 1.0
body: <p>I'm trying to put a particle system together in Android, using OpenGL. I want a few thousand particles, most of which will probably be offscreen at any given time. They're fairly simple particles visually, and my world is 2D, but they will be moving, changing colour (not size - they're 2x2), and I need to be able to add and remove then.</p>
  
  <p>I currently have an array which I iterate through, handling velocity changes, managing lifecyling (killing old ones, adding new ones), and plotting them, using glDrawArrays. What OpenGl is pointing at, though, for this call, is a single vertex; I glTranslatex it to the relevant co-ords for each particle I want to plot, one at a time,  set the colour with glColor4x then glDrawArrays it. It works, but it's a bit slow and only works for a few hundred particles.  I'm handling the clipping myself.</p>
  
  <p>I've written a system to support static particles which I have loaded into a vertex/colourarray and plot using glDrawArrays, but this approach only seems suitable for particles which will never change relative location (ie I move all of them using glTranslate), colour and where I don't need to add/remove particles.  A few tests on my phone (HTC Desire) suggest that trying to alter the contents of those arrays (which are ByteBuffers, pointed to by OpenGL) is extremely slow.  </p>
  
  <p>Perhaps there's some way of manually writing the screen myself with the CPU. If I'm just plotting 1x1/2x2 dots on the screen, and I'm purely interested in writing and not doing any blending/antialiasing, is this an option? Would it be quicker than whatever OpenGl is doing?  </p>
  
  <p>(200 or so particles on a 1ghz machine with megs of ram.  This is way slower than I was getting 20 years ago on a 7mhz machine with &lt;500k of ram! I appreciate I'm using Java here, but surely there must be a better solution.  Do I have to use the NDK to get the power of C++, or is what I'm after possible)</p>