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

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

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