How to draw smooth text in libgdx?

font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); This gets the texture used in a BitmapFont and changes its filtering to bilinear, allowing higher resulting image quality while both up- and downscaling it at the cost of slightly slower (the difference is usually not noticeable) GPU rendering.

java and libGDX / LWJGL game fullscreen wrong size for multiple monitors on Ubuntu

I would refrain from using Toolkit.getDefaultToolkit() and use solely lwjgl.util.Display.getAvailableDisplayModes() or the method described by libgdx. Once you have set up a fullscreen window, fetch its size (if your set-up method doesn’t already know that) and only use this information from thereon. If Display.getAvailableDisplayModes() changes its sort order on different executions, simply re-sort them and … Read more

General error during semantic analysis: Unsupported class file major version 57

This is not a LibGDX issue. Gradle 5 is incompatible with Java 13. You either need to update Gradle (the wrapped version in your project) to Gradle 6 or later, or you need to use a lower version of the JRE. To update the wrapped gradle, go to gradle/wrapper/gradle-wrapper-properties in your project and update the … Read more

How do I troubleshoot “Inconsistency detected: dl-lookup.c: 111” (Java Result 127) error?

Downgrade OpenJDK 11 to 8 I had the same problem in Xubuntu 18.04 with Eclipse 2018-12 (4.10.0), using LibGDX. It was working fine, but probably some update in the system (or to OpenJDK specifically) started this problem. In addition Gradle Tasks weren’t showing up in the Gradle Window. I solved the issue by removing theses … Read more

How can I draw text using Libgdx/Java?

I don’t see much reason of creating separate batch for text drawing. Using gdxVersion = ‘1.4.1’ (built with gradle in Android Studio) that code draws text successfully: BitmapFont font = new BitmapFont(); //or use alex answer to use custom font public void render( float dt ) { batch.setProjectionMatrix(camera.combined); //or your matrix to draw GAME WORLD, … Read more

libgdx SpriteBatch render to texture

This snippet was given to me on the LibGDX forum and it works flawlessly. private float m_fboScaler = 1.5f; private boolean m_fboEnabled = true; private FrameBuffer m_fbo = null; private TextureRegion m_fboRegion = null; public void render(SpriteBatch spriteBatch) { int width = Gdx.graphics.getWidth(); int height = Gdx.graphics.getHeight(); if(m_fboEnabled) // enable or disable the supersampling { … Read more