I Rewrote The Graphics Layer...

Today's goal: Finish our initial implementation of TrueType font rendering!

Updates

So about those OpenGL APIs…

After Tuesday's stream, I looked at the OpenGL text rendering sample we were using from learnopengl.com. I then realized why they were using shaders!

That led me on a path to get shaders working in the engine, and then I realized I had been using deprecated OpenGL APIs since we switched from SDL to GLFW…

I've rewritten all of the rendering logic to now use vertex arrays and shaders! This actually puts us in a perfect spot for future work.

Benefits

  • Potential for much better rendering performance
  • Can more efficiently pass our data structures directly to OpenGL
  • Shaders give us many possibilities for rendering effects

Tasks

DONE Rewrite glyph renderer using new OpenGL APIs and a shader

DONE Implement "proper" glyph alignment

DONE Use FontConfig to find the font by name

TODO Maybe add a nice gradient to rendered text?

Next Steps

TODO Investigate using HarfBuzz (or Pango) to get proper kerning vectors for character pairs

TODO Render all glyphs to a single texture atlas for performance

TODO Possibly "bake" a texture for static strings to reduce draw calls