Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Sprites - Software Batches vs Hardware Instancing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Vincent_M   Members   -  Reputation: 748

Like
0Likes
Like

Posted 01 September 2014 - 12:22 PM

I've started to dive into OpenGL 4.3, and the instancing alone is pretty exciting. Now, I'm wondering: would it be better, performance-wise, to start rendering my sprites using instanced rendering approaches, or should I continue to pack all of my sprites into one vertex buffer, software transform them, and update the OpenGL buffer, and draw with a single call to glDrawElements? The major cons to this is that anytime I want to position, rotate scale, or move a parent object in my hierarchy that my sprite is attached to, I have to update not just the matrices, but the vertices in software too. I'm also coming from OpenGL ES 2.1 where VAOs didn't exist. Now that they're mandatory, updating the buffer, as mentioned above, will be costly in addition to all the software math.

 

Instanced rendering also makes rendering in layers less of a hassle to implement. For example, let's say I have 100 sprites all using the same atlas, but some of Layer 1 drawn by one of my scene's cameras, and some are on Layer 2 where another camera draws Layers 1 and 2. Let's assume that these sprites' vertices aren't grouped up by layer in the vertex array due to draw-order constraints due to depth.

 

Then, there's drawing order... If I have 2 overlapping sprites, and I want the 2nd sprite to be drawn on top of the 1st one, the 2nd sprite's vertices MUST be before the 1st sprite's vertices in the array. Now, would instanced rendering fix this to where I wouldn't need to worry about the order in which I render my sprites?



Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS