Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a small 2D SHMUP for Android at the moment. Pure 2D rendering with Bitmaps turned out to be a bit too slow, especially with a lot of alpha blending going on. So I decided to switch my rendering backend to OpenGL. Last time I used OpenGL there was still immediate mode. I now want to build a modern architecture with OpenGL ES 2.0.

Here are the details: Most of the time I am going to display a lot of Sprites, that are essentially texure mapped quads consisting of 2 triangles each. I am probably going to want to render a lot of them :) I am going to use Vertex Buffers because of the faulty VBO implementation in Froyo.

Here's the question: How would I manage the position data of the independent sprites? Do I need to modify my vertex buffers each time a sprite changes its position? Or is it faster to use a single draw call and translation matrix for each sprite?

share|improve this question
up vote 1 down vote accepted

For a large number of sprites, each of which is just a quad, I'd lean toward using dynamic vertex buffers and drawing them all in one draw call. The sprite bitmaps will all need to be in one atlased texture for this, since you can't switch textures in the middle of a vertex buffer.

Disclaimer, though: my experience is based on PC and console hardware and I'm unfamiliar with the performance tradeoffs on mobile hardware, which might be different.

share|improve this answer
Thanks Nathan. That means, that if the positions of the sprites change, I edit the buffer in the places with the vertex information (hence dynamic) and use the buffer on the next draw cycle? – thalador Jul 12 '12 at 21:37
Something like that. I'm not sure just what the setup is to do dynamic vertex buffers efficiently in OpenGL. In D3D you'd map the buffer with the MAP_WRITE_DISCARD flag to regenerate it each frame. That probably doesn't help you much though. :) – Nathan Reed Jul 12 '12 at 21:56
In OpenGL glBufferData and glBufferSubData will create and update the vertex buffer contents. glBufferData() with GL_DYNAMIC_DRAW will indicate that the buffer is used for rendering and will change frequently. – Aaron Jul 13 '12 at 2:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.