Displaying Text in OpenGL

Started by chrizo, February 06, 2008, 15:59:46

Previous topic - Next topic


:D lol, well im out of ideas   :-\



if your desperate to get that ttf workn in the mean time, bofore the call to print text,

reverse it:

use GL11.glScalef(-1, 1, 1);
or GL11.glScalef(1, -1, 1); //depending on which way you want it to print -x, or -y

and after the call to print text:

this should work until you find out what is wrong.

anyway sry cant be anymore help, that works as a dodgy bandaid.


Quote from: Schnitter on March 23, 2008, 16:01:18
I always wanted to do it myself - so, do you know any tutorial to use ttf-fonts in lwjgl-applications?
If you like real ttf fonts,  not rasterized to a texture, its a quite complex matter. You can do it this way:

-Loading of a font via AWT:   font=Font.createFont(Font.TRUETYPE_FONT, inputStream)
-font.createGlyphVector can be used to obtain a "GlyphVector" for a String
-glyphVector.getOutline() returns an  "Shape" of the String...
-shape.getPathIterator() returns an  "PathIterator"...
-the PathIterator allows you to step the contour of the text as splines.
-build a FlatteningPathIterator(pathIterator)
-the FlatteningPathIterator allows you to step the contour as straight line segments (linearizing the splines)
-the countour needs to be fed to an triangulation algorithm (several sources out there.)
-resulting triangles can by drawn as GL_TRIANGLES

Quite complex.. For sorry I have no complete code, but sucessfully used this way to build particle text objects some time ago.