LWJGL
May 20, 2013, 10:36:15 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: 1 2 [3]
  Print  
Author Topic: Displaying Text in OpenGL  (Read 23421 times)
bobjob
Prolific Timewaster
****
Posts: 335


LWJGL: WOW SO GOOD


« Reply #30 on: March 23, 2008, 12:16:13 »

Cheesy lol, well im out of ideas   Undecided
Logged

LWJGL Benchmark online test:
http://have2chat.net/benchmark/
http://have2chat.net/benchmark/fullpage.html (run full OpenGL webpage)
Schnitter
Newbie
*
Posts: 43


« Reply #31 on: March 25, 2008, 14:20:01 »

Any other ideas?^^
Logged
bobjob
Prolific Timewaster
****
Posts: 335


LWJGL: WOW SO GOOD


« Reply #32 on: March 26, 2008, 15:20:22 »

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

reverse it:

GL11.glPushMatrix();
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:
GL11.glPopMatrix();

this should work until you find out what is wrong.

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

LWJGL Benchmark online test:
http://have2chat.net/benchmark/
http://have2chat.net/benchmark/fullpage.html (run full OpenGL webpage)
dronus
Newbie
*
Posts: 36


« Reply #33 on: June 24, 2008, 14:32:06 »

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.

Logged
Pages: 1 2 [3]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!