Text output in OpenGL

I am still on the port of my windows game, i compleaded the grafik output except the text output.
Up to now i am using the windows fonts(like it is described at http://www.nehe.gamedev.net ) And now i am seaching for an way to do this on linux! I dont know, if there is an possibility to do it for windows and Linux. plz help me!

thx Krabb

fonts are an OS-dependent thing. spefically, the windows/mfc api has functionality that is unique to windows. in X, it also handled differently. that said, seamless porting of your gl fonts aren’t likely [as far as I know, anyway]. however, there are bitmap fonts - basically a “picture” of fonts and you can simply create quads and apply the font texture on top of it. I recall http://nehe.gamedev.net/ having a tutorial on it.

I hope that helps.


hmm… the one in nehe refers the wgl functions [which is spefici to windows]. gametutorials [ http://www.gametutorials.com/Tutorials/opengl/opengl_pg4.htm#Fonts ] has the implementation I was talking about.

This is a such a FAQ, there’s even a section on OpenGL font technologies on this site. Shouldn’t be difficult to find.

A FreeType-based solution will let you use real fonts in a cross-platform way. FTGL is probably the best of the ready-made FreeType-based libraries, but it’s not too difficult to roll your own code either if you want to. There’s an example of a different approach to FTGL’s on my site – check out font.c in http://onesadcookie.is-a-geek.net/svn/repos/RubyGameCommon

thx for your fast answers and links!
I think i will do it by loading my own bitmaps, but i only wanted to know, if there is an better way…

the tutorial at http://www.gametutorials.com/Tutorials/opengl/opengl_pg4.htm#Fonts
is windows specific too, i checked both of the sides, which you posted, before asking here :slight_smile:
edit: Ohh, i was wrong, there is an none windows specific tutorial too, thx!


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.