LibGDX Draw with Anti-Aliasing to a non-default FrameBuffer [RESOLVED]

To be short and to the point, I draw to a FrameBuffer I create and then export the contents of that FrameBuffer to a Texture, in order to save me processing power on phones by pre-rendering my image. However, MSAA is only performed by OpenGL 20 on the default FrameBuffer, if I understand correctly.

Therefore, is it possible to get cross-platform Anti-Aliasing of any kind on a non-default FrameBuffer, and how can I accomplish this? I am sorry if this is a very general question, but I hardly know anything about OpenGL itself. I’ve looked into it a little bit, but LibGDX doesn’t always seem to have all the functions that I see available (e.g., glGetTexImage, since I’m not sure how to actually retrieve the texture as a Libgdx Texture), or there just plain isn’t much documentation (as far as my searches have taken me) on how to apply Anti-Aliasing through a non-default FrameBuffer in OpenGL through LibGDX.

TLDR; How do I use Cross Platform Anti-Aliasing on an FBO through LibGDX?

Since this question has to do with problems related to my attempt to speed up my rendering, I am putting it in Performance Tuning. Please move this thread to the proper sub-forum if I’m incorrect.


EDIT: According to, MSAA with FBO is impossible on Android devices, but that was back in 2012. Even if it’s still impossible on some Android devices due to hardware restrictions or something like that, is it possible to use MSAA through LibGDX with devices that do support it on FBO, or failing that, is any anti-aliasing (preferably not FSAA as that uses a lot of resources) possible on FBO through LibGDX?

If everything else fails, you can always do it manually. Render to a texture that is a multiple of the size desired. Then let the GPU generate mipmaps and copy that mipmap layer into a texture, or downsample it yourself. It’s much more computationally expensive than proper AA, but as it’s part of a pre-rendering effort, you can probably get away with this simple workaround.

Don’t forget you can also simply use the draw-(frame)buffer to compose these pre-rendered textures/sprites: clear buffer, draw sprite content, copy to texture, clear buffer, start rendering actually visible content. This is how everybody did it prior to FBOs / pbuffers.

Thank you Riven, it didn’t occur to me that I could do it manually like that, I’m kind of new to LibGDX, never even mind OpenGL.

I tried downsampling and am indeed getting a clearer image. Better yet, since I’m mostly just pasting a bunch of much smaller sprites with various rotations onto this bigger texture, I’m just downsampling the rotated versions of the smaller sprites as opposed to downsampling the entire thing. Not really sure if there’s a limit on texture sizes.

I’m not really sure how exactly the second method works, or that I really understand the difference between a “draw-(frame)buffer” and an FBO.

All in all, the downsampling method works as a sufficient replacement for MSAA, thank you very much for the advice. :slight_smile: