Hello Guest

Yet another glFont

  • 5 Replies
  • 14314 Views
*

Offline ndhb

  • **
  • 70
Yet another glFont
« on: November 12, 2006, 23:13:03 »
Hi all. There are several libs around but if someone hasn't found them and wants to draw some bitmap fonts in OpenGL:

* I've made a few classes that renders text in orthographic (2D) and perspective (3D).
* It currently only supports loading fonts created with Codehead's Bitmap Font Generator (http://www.codehead.co.uk/cbfg).
* It's implemented with display lists and at least it's fast enough for my own purposes (creating new text, results in display lists created which can occur a temporary stall).
* There's no support for unicode. To support unicode I'm considering writing a loader for BMFont (http://www.angelcode.com/products/bmfont).
* You're free to use it for whatever purpose if you include me (ndhb) in the credit.
* There's some generated javadoc that explains how it works (or look at TestFont.java).

Looks like this:


Please post if you try it and find any bugs or issues!

Download:
http://85.235.22.202:8080/dk.nesos.font.01a.zip

« Last Edit: February 10, 2015, 23:43:30 by ndhb »

Yet another glFont
« Reply #1 on: November 13, 2006, 01:05:48 »
looks pretty cool!

i was doing dynamic font generation using BufferedImage and Graphics2D so it can generate whatever the text in any languages as long as Java supports them, but of cource, it has some speed issue...

*

Offline appel

  • *
  • 18
Yet another glFont
« Reply #2 on: November 13, 2006, 09:13:30 »
That's awesome work ndhb :)

But one thing though! If you zoom in on the characters that overlay the big blue text you'll notice a black border. This is most likely due to the anti-aliasing. It wouldn't look good on a colored background, like in-game.

You could try to change the clearColor, see what happens.


Isn't there a way around this?

*

Offline ndhb

  • **
  • 70
Yet another glFont
« Reply #3 on: November 16, 2006, 16:34:12 »
The border is due to the blending function I used. Changing the blending "solves" the issue. There are a lot of options and parameters to adjust (BlendFunc, AlphaTest, AlphaFunc, Texture mode, etc.) that can change the appearance of the text. I havn't had much time to experiment but it should be possible to achieve almost any effect (even stencilfun). Here's another screenshot with a different blending function.



from the code http://85.235.22.202:8080/dk.nesos.font.01b.zip

One of the nice thing about bitmap fonts is the versability, then again it can be hard to achieve the effect you have in mind without a lot of experience with all the different knobs and switches (which I don't really have).
« Last Edit: February 10, 2015, 23:43:42 by ndhb »

Re: Yet another glFont
« Reply #4 on: March 27, 2007, 22:56:29 »
Hiho. Your font library is pretty cool. But there are at least two things I'll glad to see. First of all your BitmapFileFont loader is only capable of loading fonts from files not from URL oder File objects, so putting font files into a jar is very hard.
Also some setScale(float)/getScale() method for the Font class would be nice. Sure you can do this with glScale() for your own, but only when doing this via drawText3D().

Keep on working man!! After I found you lib, I'm the happiest man here  ;D

*

Offline ndhb

  • **
  • 70
Re: Yet another glFont
« Reply #5 on: August 10, 2007, 10:44:33 »
« Last Edit: August 10, 2007, 10:46:08 by ndhb »