Re: [Plib-users] Couple of fntRenderer questions
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2001-09-11 00:34:01
|
Jason Steele wrote:
> I hope I'm not missing something obvious here...
Yep - you are.
> but is there a way to do rotated text (vertical in particular) with fntRenderer/fntTexFont
> in 1.5.1?
Yes....how about: glRotatef :-)
Try (for example) adding the following two lines to the end of 'setOpenGLState' in the
PLIB example program 'examples/src/fnt/fnt_test.cxx' and the text will spin quite happily.
In general, the text is drawn relative to the origin in the Z==0 plane - but all of the
usual OpenGL modelview transformations will work so you can apply text to 3D objects
and do all sorts of other amusing tricks.
> (I'm using fnt.h, but not PUI)
Good - PUI doesn't really support rotated things - but
raw FNT does.
> Also, other than the GL_TEXTURE_2D, is there any other effect on the
> OpenGL state that has to be undone after a begin()/puts()/end()
> sequence? Is there a cleaner way to restore the state other than
> an explicit glDisable(GL_TEXTURE_2D) after I do my font rendering?
State management in OpenGL is a pain. You can use glPushAttrib/glPopAttrib
to save and restore state - but it's quite slow.
Similarly, saving and restoring state can be quite inefficient if it's
done 'strictly by the book'...glGet{anything} is extremely slow - so
you really have to remember what state you have in your own code and
restore it after.
There really isn't a single 'good' way to do this :-(
> Finally, is there a way to query the inter-line space from either the
> font or the renderer? getBBox() doesn't quite do what I need. I see
> in the source there's a hardcoded 1.333*point size increment of the
> cursor's y position for a '\n' (that's the quantity I'm after)
> Is there a way to get this without hardcoding the 1.333 in my
> code? If not, can I put in a request for this value to be exposed
> through the interface? (allowing modification of it as well would be
> a bonus
There isn't a way to do that right now...there was no way to read out
the amount of 'inter-line-gap' from the TXF file - so I had to choose a
'reasonable' value. My father was a professional printer - and he said
that a third of the total height of the line is a reasonable rule of thumb.
The best bet is not to let FNT handle the '\n' but to do it yourself and
use glTranslate to position the text.
----------------------------- Steve Baker -------------------------------
Mail : <sjb...@ai...> WorkMail: <sj...@li...>
URLs : http://web2.airmail.net/sjbaker1
http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
http://prettypoly.sf.net http://freeglut.sf.net
http://toobular.sf.net http://lodestone.sf.net
|