Saves us having to do a bunch of extra legwork (setting up the blank
default texture, setting the colour modifier to white, etc.), and
should improve performance.
While I was at it, I made the colour modifier a uniform, so it only
has to be set once per quad, rather than once per vertex.
This replaces the glBegin/glEnd stuff. Even though vertex arrays
aren't removed from newer OpenGL versions like glBegin/glEnd are,
they *are* deprecated, so I want to switch to VBOs eventually.
This fixes the Texture backend bug that made the program take forever
to shut down:
The problem was that the font system would try to load a glyph that's
0 pixels wide/tall (likely the space character), which SDL2 didn't
like, so it would fail to allocate the texture, causing
Backend_CreateSurface, and by extension Backend_CreateGlyph, to
return a NULL. Later, upon shutdown, the font system would pass this
NULL to Backend_FreeGlyph, causing NULL pointer dereferences that
make the program take forever to shut down.
Personally, I think passing NULLs to the backend is valid behaviour,
so I've added a bunch of sanity checks to make sure they're never
dereferenced.
Hard mode. Wound up debugging a weird issue for about half an hour.
Turns out you don't need to reset the matrix when you switch
framebuffer target? I don't really know how that works.
Anyway, yay font rendering is in the OpenGL backend now.
Yay 100% hardware-acceleration. Yes, I know 2.1 is outdated and
crappy, but it was the easiest one to write. I'll probably make an
OpenGL 3.0 Core renderer at some point.
Anyway, font rendering isn't here yet, because I plan to overhaul it.