I Rewrote The Graphics Layer...
Today's goal: Finish our initial implementation of TrueType font rendering!
Updates
- Join the Discord for Flux Harmonic: https://discord.gg/ryy97Rdw
- I rewrote the graphics layer
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?
Notes
The code for this stream can be found here:
https://github.com/FluxHarmonic/flux-compose/commit/4f03833978ce75b1715fccf87a64d7ca33b16580
References
- https://learnopengl.com/In-Practice/Text-Rendering
- Getting fonts with FontConfig: https://stackoverflow.com/questions/10542832/how-to-use-fontconfig-to-get-font-list-c-c
- Crafting Interpreters book: https://craftinginterpreters.com/