Sign in to follow this  
i_luv_cplusplus

Text rendering VBO-way

Recommended Posts

I want to add some core profile text rendering to my engine. I came across this post by Yann L:
http://www.gamedev.net/community/forums/viewreply.asp?ID=3600571 where he advises to render fonts on CPU to a texture and render quads. I don't see it as a feasible solution, as it would force me to make lots of DrawElements for single quads (it forces me to change texture every text line).

Yann L is also negative towards display list implementation of text rendering. This makes me wonder: does the same thing apply to VBOs? Is clearing a VBO and filling it with quads every frame a good solution for rendering text? If not, what are you people using to render text?

Share this post


Link to post
Share on other sites
TTK-Bandit    120
My current text renderer (bitmapped font) uses simple quads, since back then I didn't see any way to get kerning working properly together with partial coloring of the string.
Recently I saw that FreeType2 finally lost all the patent issues, so I was thinking of doing it this way:
Render a complete line into a bitmap, upload it and then just draw one quad per line.
Not sure how the performance would do on this one, but since you rarely render text for a few frames only, it could be good.
Then again, I never used freetype, so I don't know how fast it is in live rendering.
I don't think it'll be worse than my current approach tho.

A Plus would be that no stretching has to be done and text should be nicely drawn.

Didn't have the time yet to start coding it, so this is all theory.

Share this post


Link to post
Share on other sites
Katie    2244
You could make a bigger texture with >1 font on it.

You could load several textures into the various texture samplers and use either a simple pixel-shader routine to pick the right one or use earlier opengl 2 style multitexturing.

This way, you just have a set of textures and a VBO to select.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this