2
\$\begingroup\$

I'm planning on rendering many sprites in my games, but I am not sure which method of storing their data to use. I haven't tried all of them yet, but I want to see if I also have anything important missing. Right now my options are:

  • Store information such as position, color, rotation, scale, and texIndex in a VBO, and then let the geometry shader output the triangles. (Not sure if possible)

  • Compute the vertices for all sprites in the CPU and put it all into one VBO to draw. (Sounds like a waste of CPU time, especially in a game)

  • Store repeated copies of the same four vertices in a VBO, and then use uniforms? (This is just an idea, I have no idea if it works or makes sense) Apparently I can just use instancing for this.

What design should I use to efficiently store sprite data? Do any of my ideas hold?

Edit: I would greatly appreciate if pseudocode could be provided for a solution, although certainly not necessary.

\$\endgroup\$
  • \$\begingroup\$ Third option sounds like instancing, you might want to look into that. I'm currently using option 1 i would like to know the answer too. \$\endgroup\$ – Greffin28 May 6 '16 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.