1

I'm trying to render some particle effects in Android using OpenGL. Each particle will be a billboarded textured quad and each particle is rendered with a rotation (i.e. around the z axis). I'm restricted to using OpenGL ES 1.1 so point sprites and pixel shaders aren't an option. What is a fast way of rendering and updating the positions of many particles (e.g. 100 to 5000)?

I know that using an OpenGL draw call for each particle is going to be very slow but I'm confused at how to use things like VBOs when I need to update my particle positions each frame.

genpfault
  • 47,669
  • 9
  • 68
  • 119
RichardNewton
  • 816
  • 1
  • 12
  • 20
  • Careful with VBO - many phones, even the original Droid, don't necessarily support them. – EboMike Dec 10 '10 at 01:14
  • Really? I'm using VBOs on a Milestone right now. I thought VBOs were required for OpenGL 1.1 support? Isn't it pretty much impossible to get fast OpenGL performance if you've got a lot of dynamic objects and no VBOs then? – RichardNewton Dec 10 '10 at 01:16
  • Check out this question: http://stackoverflow.com/questions/2093594/opengl-extensions-available-on-different-android-devices . The Droid doesn't list GL_ARB_vertex_buffer_object. The funny thing is Lance Nanek's answer where he points out that this seems to be a problem in the capability reporting, since the Droid should have VBO (which you just confirmed). – EboMike Dec 10 '10 at 01:21
  • I read this post a while ago and assumed the solution was to expect VBOs when ("OpenGL 1.1 support is reported" || "OpenGL reports that the GL_ARB_vertex_buffer_object extension is available") is true. Is this correct? – RichardNewton Dec 10 '10 at 01:24

1 Answers1

1

Random idea. May or may not work well. Use one draw call, or at least batch particles together into groups (say, 32 per group). You can construct every group per frame on the CPU and then send it down. Just construct one big array with GL_TRIANGLE_FAN (IIRC you an "terminate" fan by adding the same vertex twice).

One of the challenges, I believe, is to create this buffer. Is this Java or JNI? Are you using a java.nio buffer? From what I read in the forums, modifying those buffers in Java can be terribly slow. (Btw - I'm not that familiar with the internal buffer handling on Android, you may or may not need to double-buffer them.)

EboMike
  • 72,990
  • 14
  • 152
  • 157