Hello world! I'm working on a game and I've recently switched to LibGDX to get better performance, more target platforms, and a few other reasons, so I'm relatively new to a lot of OpenGL.
From what I understand, LibGDX runs most efficiently using bitmap fonts rendered to a single texture, that uses a texture atlas to select a specific character. For my purposes, this is fine.
My game uses two fonts - one being a modified version of the other. I have placed them below:
While there are cases where I'd use both fonts on their own, there may be times when I need to use both simultaneously. For instance, I will be animating some text to randomly switch to the modified version to provide a "glitchy" aesthetic.
According to this article (http://www.streamingcolour.com/blog/2009/08/27/texture-atlases-and-bitmap-fonts/
), the reason bitmap fonts are stored into one texture is because changing to another texture can be a relatively expensive operation.
Here's the actual quote:
The reason this is done is that every time OpenGL has to change which texture it’s currently drawing with, it takes time. So if you draw, say, 100 different little sprites every frame, and each one is in it’s own texture, OpenGL has to change which texture it’s using 100 times. This can lead to a lot of inefficiency and can actually significantly slow your rendering code. But if you put those 100 sprites into one big texture atlas, then OpenGL doesn’t need to swap textures, it just changes the coordinates of the current texture each time.
As such, is it possible to put both of my bitmap fonts together as one texture and alternate between the two fonts when necessary? If so, how would I do this in LibGDX?