Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LibGDX antialiasing

Tags:

Is there a way to implement antialiasing in LibGDX?

My lines are very pixilated.

Screenshot

like image 637
ComanderKai77 Avatar asked Mar 13 '16 10:03

ComanderKai77


Video Answer


1 Answers

To smooth any line or shape use multi sampling anti aliasing

replace:
Gdx.gl.glclear()

with:
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT | (Gdx.graphics.getBufferFormat().coverageSampling?GL20.GL_COVERAGE_BUFFER_BIT_NV:0))

and for Android, open AndroidLauncher.java file and put : config.numSamples = 2 2 is a good value

for desktopsconfig.samples=3 this will do your work...

like image 154
Ashwani Avatar answered Sep 20 '22 07:09

Ashwani