I was wondering what would be a good way to make a Font engine with the LWJGL to write text. The one I wrote currently works like this:
1.) Create a new StaticText class object passing in the X Y positions and the string that will be displayed.
2.) In the StaticText constructor, create a blank texture, bind a FrameBufferObject for rendering, and render all the letters into that new texture
3.) Since the StaticText class is extended to Component which holds the x,y,textureId variables, the renderer can loop through the Component array and draw everything.
Basically, every text object is rendered in the beginning within its own textureID so it doesnt have to render each letter again after every frame. Is this a slow way of doing a font engine? Any feedback?
Thats a pic of my font engine. The red outline is the size of the texture. When you pass in different lines "/n" it calculates how big the width and height of the texture has to be to fit in all lines.