Freetype/GL/VBO/shaders

Started by
11 comments, last by FireInDark 11 years, 8 months ago
Hi Folks,


You might be interested in the following code that allow to load/render freetype fonts using a single vertex buffer:

http://code.google.com/p/freetype-gl/


There are a lot of examples showing subpixel precision, zooming using distance fields, etc...

texture.png
font.png
markup.png


Nicolas
Advertisement
Just added a makefont example that allows to generate a header file with all relevant font information (texture + glyphs description) such that it can be used without freetype.
(see demo-makefont.c)

Nicolas
Looks good. I'll give it a try.
Hi,

Some update on freetype-gl with a code cleanup to reduce inter-dependencies to a minimum. The only required files are now texture-atlas, texture-font and vector.


Nicolas
How is its performance?

I tried to make a font library similar to this using 1 VBO and 1 texture, but it still didn't perform well because of the batching, that could be clearly shown through gdebugger.
I packed every glyph into a big texture, and I created a VBO for all the characters and I drew them using glDrawRangeElements().
What do you call batching exactly ?
Concerning performances, there is a benchmark demo that measure time to display the vbo versus time to create/upload/display it.


Nicolas
What do you call batching exactly ? Concerning performances, there is a benchmark demo that measure time to display the vbo versus time to create/upload/display it. Nicolas


I call batching when you send your vertices to the GPU for rendering (i.e draw calls). Obviously you wanna send as many vertices as you can with as few draw calls as you can. Now in my case I send 6 vertices / draw call (drawing a letter).

I tried out the benchmark demo, and I could see the same performance issue. If you uploaded the text every frame it was like ~80FPS, and if you uploaded only once and drew the whole text with only one draw call, then it was ~500FPSm, which should be the ideal case. But what do you do when you have to display text that changes all the time? So I thought about it, and I realized that it would be ideal to split the rendering to "static" and "dynamic" text. This way one could preserve most of the FPS without the restrictions of either techniques.
Some new update with some glyph outline demos:

outline.png

cartoon.png
Some update with ansi sequence parsing (like in an ansi terminal).
All screenshots at: http://code.google.com/p/freetype-gl/

ansi.png

Nicolas
This is fantastic. I need to add FreeType font rendering to my engine at some point. Thanks for this. :P.

This topic is closed to new replies.

Advertisement