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.

Adding Admob to libgdx

Add AdMob Ads without Firebase : Put these lines inside build.gradle of android module. dependencies { compile ‘com.google.android.gms:play-services-ads:10.2.4’ } Add permission in AndoidManifest.xml file <uses-permission android:name=”android.permission.INTERNET”/> <uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” /> Inside <application tag add Activity if want to use Interstitial Ads <meta-data android:name=”com.google.android.gms.version” android:value=”@integer/google_play_services_version” /> <activity android:name=”com.google.android.gms.ads.AdActivity” android:configChanges=”keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize” android:theme=”@android:style/Theme.Translucent” /> AndroidLauncher class. public class AndroidLauncher extends … 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

Changing the Coordinate System in LibGDX (Java)

If you use a Camera (which you should) changing the coordinate system is pretty simple: camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); If you use TextureRegions and/or a TextureAtlas, all you need to do in addition to that is call region.flip(false, true). The reasons we use y-up by default (which you can easily change as … Read more

How to render Android’s YUV-NV21 camera image on the background in libgdx with OpenGLES 2.0 in real-time?

The short answer is to load the camera image channels (Y,UV) into textures and draw these textures onto a Mesh using a custom fragment shader that will do the color space conversion for us. Since this shader will be running on the GPU, it will be much faster than CPU and certainly much much faster … Read more

“File not found” when running new LibGDX project

From libgdx wiki When you run Desktop Project The application will fail the first time. Open the Run Configuration you just created and set the working directory to the android/assets/ directory! link your desktop project to android assets folder? Go to Run => Run Configurations.. => choose DesktopLauncher, Arguments Tab => Working Directory => Others … Read more