Just to play devils advocate for a moment, but wouldnât this mean youâd only be able to render sprites? (ie. rectangles with a width/height/angle). Sure, some things (like nine patches) could be converted to sprites, but youâd loose the ability to have things like ribbons, curves, rings, circles, etc. Youâd have to draw them in separate batches, which might mean further chopping up your geometry shader sprite batches heavily.
Iâm not sure if the tradeoffs would overall be worth it. I suspect it might be highly scene dependent - I tend to have lots of non-sprite drawing, what about other people? Cas, are you faking things like your spotlights with rotated sprites?
Spotlights n that are just rotated sprites. Special effects such as radar circles, lasers, strobes, targeting reticule animations, thatâs done outside of the normal sprite rendering in a cunning sort of interleaving. It wouldnât quite work the same way as is currently in the library (which uses a the same VBOs for sprite vertices as for the effects geometry) - Iâd probably have to use a completely separate VBO to avoid all sorts of confusion.
Anyway, all moot, as not enough machine support geometry shaders yet.
@Orangy Tang
I think he refers to your âseparate batchesâ thing. As in libgdx you can have multiple instances of SpriteBatch to draw on screen, which each one holds its own properties. Based on my 2 hours experience on lwjgl, you canât do that except by popping and pushing property of GL.
[spoiler]Behold my post, prince is coming! ;D[/spoiler]
[quote]As in libgdx you can have multiple instances of SpriteBatch to draw on screen, which each one holds its own properties.
[/quote]
In this case a âbatchâ refers to sending geometry data to the GPU (e.g. VBO, vertex array, or glEnd). You need to flush the renderer and any currently accumulated sprites before you can change shaders. SpriteBatch may do this internally, just like it does whenever you give it a new texture. Having multiple SpriteBatch instances will not solve your problem.
Thereâs no need for you to flush anything - OpenGL drivers batch up the requests internally in a queue and execute them asynchronously. Thereâs still a pipeline stall server-side but thatâs just because there has to be.