I want to draw a ring (circle with big border) with the shaperenderer.
I tried two different solutions:
Solution: draw n-circles, each with 1 pixel width and 1 pixel bigger than the one before. Problem with that: it produces a graphic glitch. (also with different Multisample Anti-Aliasing values)
Solution: draw one big filled circle and then draw a smaller one with the backgroundcolor. Problem: I can't realize overlapping ring shapes. Everything else works fine.
I can't use a ring texture, because I have to increase/decrease the ring radius dynamic. The border-width should always have the same value.
How can I draw smooth rings with the shaperenderer?
EDIT: Increasing the line-width doesn't help:
Maybe you can try making a ring some other way, such as using triangles. I'm not familiar with LibGDX, so here's some pseudocode.
Alternatively, divide the ring into four polygons, each of which consists of one quarter of the whole ring. Then use ShapeRenderer to fill each of these polygons.
Here's an illustration of how you would divide the ring:
MeshBuilder
has the option to create a ring using theellipse
method. It allows you to specify the inner and outer size of the ring. Normally this would result in a Mesh, which you would need to render yourself. But because of a recent change it is also possible to use in conjunction withPolygonSpriteBatch
(an implementation ofBatch
that allows more flexible shapes, whileSpriteBatch
only allows quads). You can usePolygonSpriteBatch
instead of where you normally would use aSpriteBatch
(e.g. for yourStage
orSprite
class).Here is an example how to use it: https://gist.github.com/xoppa/2978633678fa1c19cc47, but keep in mind that you do need the latest nightly (or at least release 1.6.4) for this.
if I understand your question, maybe, using
glLineWidth();
help you.example pseudo code: