xeekworx / bitmapfonts

Bitmap Font API & Tools
MIT License
11 stars 1 forks source link

OpenGL Rendering Backend #1

Open xeekworx opened 6 years ago

xeekworx commented 6 years ago

So far just SDL and NanoVG renderers exist. I would like to also have an OpenGL renderer (granted NanoVG somewhat covers that already). After this is added, eventually I'll be able to add Signed Distance Field features to the font, but those features will be ignored / unused in the SDL and NanoVG renderers.

To create a new renderer for OpenGL, look at renderer_nanovg for clues on what to do. You derive from renderer_base and make sure these functions are overridden (the top three being the most important):

If you do not implement on_draw_line, on_draw_rect, and on_fill_rect, be sure to still override those functions, but not do anything within them. The disadvantage is if I implement a feature that needs them (glyph backgrounds, underlined, or strikeout) then that feature just will not render.

xeekworx commented 6 years ago

This might also mean adding an example_opengl.cpp source file testing this renderer in the /examples folder. This file would likely be nearly identical to the example_nanovg.cpp file that already exists since NanoVG is already utilizing OpenGL.