rendering fonts with OpenGL

Sven Panne Sven.Panne at aedion.de
Thu Jul 14 13:56:47 EDT 2005


[ redirecting to the hopengl list... ]

Am Dienstag, 12. Juli 2005 14:32 schrieb Felix Breuer:
> What is the recommended way to render fonts (i.e. text) using GHC and
> OpenGL?
>
> I know about libraries/GLUT/examples/RedBook/Font.hs, but I do not want
> to define the font's letter by hand. So, my questions are:
>
>  * Is there a ready-to-use way load fonts (e.g. using FreeType)?

AFAIK, there is no Haskell binding for loading fonts and/or a FreeType 
binding. Any volunteers?

>  * Is there a library implementing some OpenGL font rendering method
>    (bitmap, texturemap, outline, etc.) that can be used from GHC?

Not yet, apart from the rudimentary font support in GLUT, see: 
http://haskell.org/ghc/docs/latest/html/libraries/GLUT/Graphics.UI.GLUT.Fonts.html

>  * Does anyone have example code for the above?

I think the most comprehensive overview is here (of course for C only):

   http://www.opengl.org/resources/features/fontsurvey/

If you are looking for high performance font rendering with current graphic 
cards, by all means use texturing. This is what all mainstream cards that I 
know of are optimized for, and it has a few nice benefits like scalability 
and anti-aliasing. Using other techniques you easily end up waiting for the 
loooong graphic pipelines to be flushed before you can "simply" do some 
manipulations of the frame buffer. It can be very surprising if a simple 
frames-per-second counter displayed in some corner of the screen drastically 
reduces the FPS of your home-grown Quake-clone. Of course this has *never* 
happened to me... ;-)

Cheers,
   S.


More information about the Glasgow-haskell-users mailing list