FTGL - Simple Font Rendering Question

  • Follow


Hey,
I need to render a bunch of labels in a 3d scene and I need to do so
fast.  I was previously using a Qt function to do this but it was too
slow.  Now I am using FTGL and it is much faster but FTGLBitmapFont
seems to be only 2d.  It always renders the labels on top of
everything regardless of whether they are occluded or not.  I am
rendering the fonts and geometry in the correct order.

Can someone tell me how to use FTGL in it's simplest form?  I don't
need outlines.  I don't need extrusions.  I just need labels in 3d and
I need them to blend if they are occluded.

Thanks for your help...

-Willy
0
Reply uuilly 7/31/2008 2:23:59 AM

On Jul 30, 9:23=A0pm, uuilly <willy.li...@gmail.com> wrote:

> I need to render a bunch of labels in a 3d scene and I need to do so
> fast. =A0I was previously using a Qt function to do this but it was too
> slow. =A0Now I am using FTGL and it is much faster but FTGLBitmapFont
> seems to be only 2d. =A0It always renders the labels on top of
> everything regardless of whether they are occluded or not.

Are you setting the raster position correctly before
FTGLBitmapFont::Render(label)?  I'm able to achieve occluded bitmap
drawing with FTGL with something like:

   FTGLBitmapFont *font;
   ...
   font =3D new FTGLBitmapFont("configs/arial.ttf");
   font->FaceSize(72);
   ...
   glRasterPos3f(0.0f, 0.0f, 0.0f);
   font->Render("asdfasdfasdfasdfasdfads");

There are other font options.  This is what I understand of them:

   FTGLBitmapFont - simple and screen-aligned, uses glBitmap
   FTGLPixmapFont - similar but more expensive than bitmaps, but uses
transparency for antialiasing
   FTGLTextureFont - rotates with host geometry, fastest, requires
billboarding to keep screen-aligned
   FTGLPolygonFont - text is the host geometry, rotates with scene

All fonts have the same interface.  I think you need to turn texturing
on for texture fonts.

- Chris
0
Reply crjjrc 7/31/2008 1:57:16 PM


On Jul 31, 6:57=A0am, crjjrc <crj...@gmail.com> wrote:
> On Jul 30, 9:23=A0pm, uuilly <willy.li...@gmail.com> wrote:
>
> > I need to render a bunch of labels in a 3d scene and I need to do so
> > fast. =A0I was previously using a Qt function to do this but it was too
> > slow. =A0Now I am using FTGL and it is much faster but FTGLBitmapFont
> > seems to be only 2d. =A0It always renders the labels on top of
> > everything regardless of whether they are occluded or not.
>
> Are you setting the raster position correctly before
> FTGLBitmapFont::Render(label)? =A0I'm able to achieve occluded bitmap
> drawing with FTGL with something like:
>
> =A0 =A0FTGLBitmapFont *font;
> =A0 =A0...
> =A0 =A0font =3D new FTGLBitmapFont("configs/arial.ttf");
> =A0 =A0font->FaceSize(72);
> =A0 =A0...
> =A0 =A0glRasterPos3f(0.0f, 0.0f, 0.0f);
> =A0 =A0font->Render("asdfasdfasdfasdfasdfads");
>
> There are other font options. =A0This is what I understand of them:
>
> =A0 =A0FTGLBitmapFont - simple and screen-aligned, uses glBitmap
> =A0 =A0FTGLPixmapFont - similar but more expensive than bitmaps, but uses
> transparency for antialiasing
> =A0 =A0FTGLTextureFont - rotates with host geometry, fastest, requires
> billboarding to keep screen-aligned
> =A0 =A0FTGLPolygonFont - text is the host geometry, rotates with scene
>
> All fonts have the same interface. =A0I think you need to turn texturing
> on for texture fonts.
>
> - Chris

I think I see what's going on.  The texture fonts are HUGE relative to
my coordinate system.  I had to scale down by a factor of 100.  Thanks
for the info, I really appreciate it.
0
Reply uuilly 7/31/2008 8:25:17 PM

On Jul 31, 1:25=A0pm, uuilly <willy.li...@gmail.com> wrote:
> On Jul 31, 6:57=A0am, crjjrc <crj...@gmail.com> wrote:
>
>
>
> > On Jul 30, 9:23=A0pm, uuilly <willy.li...@gmail.com> wrote:
>
> > > I need to render a bunch of labels in a 3d scene and I need to do so
> > > fast. =A0I was previously using a Qt function to do this but it was t=
oo
> > > slow. =A0Now I am using FTGL and it is much faster but FTGLBitmapFont
> > > seems to be only 2d. =A0It always renders the labels on top of
> > > everything regardless of whether they are occluded or not.
>
> > Are you setting the raster position correctly before
> > FTGLBitmapFont::Render(label)? =A0I'm able to achieve occluded bitmap
> > drawing with FTGL with something like:
>
> > =A0 =A0FTGLBitmapFont *font;
> > =A0 =A0...
> > =A0 =A0font =3D new FTGLBitmapFont("configs/arial.ttf");
> > =A0 =A0font->FaceSize(72);
> > =A0 =A0...
> > =A0 =A0glRasterPos3f(0.0f, 0.0f, 0.0f);
> > =A0 =A0font->Render("asdfasdfasdfasdfasdfads");
>
> > There are other font options. =A0This is what I understand of them:
>
> > =A0 =A0FTGLBitmapFont - simple and screen-aligned, uses glBitmap
> > =A0 =A0FTGLPixmapFont - similar but more expensive than bitmaps, but us=
es
> > transparency for antialiasing
> > =A0 =A0FTGLTextureFont - rotates with host geometry, fastest, requires
> > billboarding to keep screen-aligned
> > =A0 =A0FTGLPolygonFont - text is the host geometry, rotates with scene
>
> > All fonts have the same interface. =A0I think you need to turn texturin=
g
> > on for texture fonts.
>
> > - Chris
>
> I think I see what's going on. =A0The texture fonts are HUGE relative to
> my coordinate system. =A0I had to scale down by a factor of 100. =A0Thank=
s
> for the info, I really appreciate it.

Also backface culling can be a problem.  I'm guessing FTGL assumes
glFrontFace( GL_CCW )

Hope this helps someone someday.

0
Reply uuilly 7/31/2008 9:12:05 PM

3 Replies
277 Views

(page loaded in 0.178 seconds)

Similiar Articles:













7/25/2012 8:43:45 AM


Reply: