SFML community forums
Help => Graphics => Topic started by: Jabberwocky on September 01, 2014, 11:29:31 am
-
Hi,
Here's a simple use-case to set the stage for my question.
I'm making a top-down view game. I'm rendering a table top, with a plate on the table, and an apple on the plate. I want to draw this with a single VertexArray (using a texture atlas) for performance / batch count reasons. The table, plate, and apple are separate images within the atlas (and must be so, so different tables can have different items on top).
So I make a VertexArray of Quads primitive type. The VertexArray has 3 quads (12 verticies).
- The first quad is the table texture
- The second quad is the plate texture
- The third quad is the apple texture
Question: Am I guaranteed that the apple will always be drawn overtop on the plate, and the plate overtop the table? Or is there no guarantee of which order the quads within a VertexArray will be drawn?
Thanks for the help.
-
Am I guaranteed that the apple will always be drawn overtop on the plate, and the plate overtop the table?
Yes, OpenGL draws primitives in the order they appear in the vertex array.
-
Wow, that was fast! :)
That's good news. Thanks, Laurent.