How to use fonts in opengl in java?

The title pretty much sums it up - its the lightest in the world in C ++ and Windows, but Java seems to be trying to deal with this problem.

I would like to stay away from solutions related to downloading font bitmaps, and instead try finding your own TrueType font loader in your own way. Kerning and anti-aliasing are very important in my application.

+4
source share
4 answers

Use the JOGL / Java 2D bridge: render the font on the texture.

Check out "Java 2D and JOGL" [1]

[1]: http://weblogs.java.net/blog/campbell/archive/2007/01/java_2d_and_jog.html ""

+2
source

JOGL has a TextRenderer class that should do what you want. It takes a Java β€œFont” object, and I think you can specify any ttf file for such objects. It also supports anti-aliasing, I'm not sure kerning, but probably also. :)

Unfortunately, JOGL docs are currently ... missing. I don’t know where they went, I hope they will return soon (in a day or two). Otherwise, I would link you to the documentation for the class. Excuse me!

+2
source

Another thing you can do (for example, if you want a full-featured lighting function for text), build a GlyphVector from a font and a string and use the GLUtessellator to display it as a set of triangles.

+2
source

JOGL is pretty good. I used Processing (processing.org) before this makes good text. Yes, C ++ and OpenGL on Windows seem easy because font management is different (Linux and MacOSX = it’s much harder to make text with OpenGL, which I found)

+1
source

All Articles