This tutorial is a Gl4java specific tutorial. We will use here
GLF to render 3D text.
Neither Jogl nor Jogl-JSR231 support GLF utilities.
If you want to use 3D Font with Jogl/Jogl-JSR231, take a look at the Jogl Add-On
page.
GLF provide access to draw 3D text using predefined font.
GLF glf = new GLF()
Predefined fonts are located in the glf support jar (gl4java-glffonts.jar)
in the *.glf format.
To use one of these fonts, we need to load it with :
glf.glfLoadFont(glfFont)
glfFont is the glf file name (file with glf
extension).
Here is a list of font available : aksent1.glf,
alpine1.glf, arial1.glf, broadway1.glf, chicago1.glf,
compact1.glf, courier1.glf, cricket1.glf, crystal1.glf,
garamond1.glf, gothic1.glf, penta1.glf,
present_script1.glf, techno0.glf, techno1.glf &
times_new1.glf.
If you want to use an another font, don't forgot to unload the previous one :
glf.glfUnloadFont()
There is two interesting features : text centering & text
direction :
glf.glfStringCentering(centered)
glf.glfStringDirection(direction)
centered tell if the string is centered of not.
direction is the rendering direction of the
text. This can be one of those constants : GLF_RIGHT, GLF_DOWN, GLF_UP,
GLF_DOWN
Now, glf is initialized. we can draw a 3D text :
glf.glfDraw3DSolidString(text)
text is a string to draw a the current position
Here is an example of drawing a 3D text using GLF :
Drawing a GLF text |
//Creates a GLF object and load a GLF font |
F : switch to a different GLUT font
Remember to download the GraphicEngine-1.1.2 to run this tutorial !
Tutorial 19 src (9 ko) //Gl4java only !!!
Tutorial 19 src (8 ko) //Gl4java only !!!
If you've got any remarks on this tutorial, please let
me know to improve
it.
Thanks for your feedback.
Copyright © 2004-2012 Jérôme Jouvie - All rights reserved. | http://jerome.jouvie.free.fr/ |