I've been looking everywhere for a way to anti-alias edges of filled shapes drawn with ShapeRenderer
(ie. ShapeType.Filled
) but can't find anything about this.
Lines works well with Gdx.gl.glEnable(GL10.GL_LINE_SMOOTH)
but nothing I've tried works with filled shapes. So, does anyone have any suggestions?
maybe this link will help: MULTI SAMPLING ANTI-ALASING IN LIBGDX ON ANDROID
in general you have to enable multisampling to have edges of filled shapes smooth.
http://www.opengl.org/wiki/Multisampling
I've found the anti-aliasing support in OpenGL to be lacking (as actual support depends on optional hardware support), especially for the basic polygon primitives. There are two solutions that I've found to work:
First, you can get reasonable multi-sampling when using textures. So, maybe render your polygon to a FrameBuffer object, and then copy that to the screen. There are still a bunch of caveats, see http://www.saschahlusiak.de/2012/10/opengl-antialiasing-in-android-with-transparent-textures/ for more details.
Second, render your filled shape with a shader that anti-aliases, as in this question: Drawing Antialiased circle using Shaders. If your filled primitive shape is complicated, this can be quite a bit of work. See https://code.google.com/p/libgdx/wiki/OpenGLShader for how to use a shader with Libgdx. This option only works with OpenGL ES 2.0, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With