I’m pretty sure I’m not the first thinking of doing a circular progress bar:
I can think on a few ways:
Have a square geometry and repaint a texture on run-time pixel per pixel
Create a circular geometry (just like a torus un 2D) and give it a color
Do some kind of trick with the blending modes
Have a square geometry and paint it in the shader
And… I think there were a few more things I though but the point is, which is really feasible and has an acceptable performance to use in multiple places in an android game? (obviously, talking about implementing it on JME3).
I did it on shaders. The most simple solution is to pass a value and check if it is greater or less than a color value on one map, and depending on that draw a pixel from main texture. A little more playing with formulas would give you nice smooth edge.
That idea already went out in the brainstorming session xD, but it has too much limitations. Thanks anyway
-O- I almost had it (or that I think) with Midpoint circle algorithm - Wikipedia and pixel painting. Your way, though, seems cleaner and simpler (the worst thing is that some time ago I already saw that solution and I forgot about it ).
The thing now is… it is better (efficiency talking now) the shader alternative or the texture painting one?
Of course not. You only need an image with a degraded color (ie: a grayscale alphamap) to use as threshold for showing the portion of another image or just a color. The threshold/progress is passed then every time it changes. In other words:
He gave some example images. An example shader would be: