I am currently looking at how font rendering is implemented and it seems that we create a texture for each code point.
I have a few questions about this:
1. Is this overkill in some way? When we eventually render the text we have to switch the texture (bind texture) for each character and I thought texture switching is expensive. At least that's what I thought, especially as other projects usually create a single texture font atlas so no texture switching is necessary; I understand if this portion will still get some polish/re-write for production quality code, just was wondering if this is the case.
2. All the textures we create for all the characters are non-power of two. Nowadays this is supported in hardware/OpenGL, but is there still any downside to this? Does the GPU still pad the textures out to power of two and are there any stretching/filtering issues with that?
3. Some code bases I have seen add an offset of 0.5/0.375 when the texture is mapped onto a quad; if this isn't done the textures looked very blurry. We don't do it here on handmade hero and the textures actually look fine. Was this offset fixing some other issue?
4. How would one verify if the texture switching is expensive or not? If this was done on the CPU I could easily benchmark this, but since this is done through OpenGL on the GPU I will only know if I hit my target frame rate or not.
Thanks.