[vtk-developers] Fwd: [vtkusers] Font rendering / hardware picking

Sebastien BARRE sebastien.barre at kitware.com
Thu May 22 10:45:30 EDT 2003

Developers, Bill, Yves, Jeff,

Someone on the list reported a problem regarding slow font rendering in 4.2

I answered (see below or in the same thread as above), raising either
         - an OpenGL slow implementation of glPixmap() for his card,
         - or the changes that was made by Bill Lorensen from 
vtkOpenGLFreeTypeTextMapper 1.27 to 1.28 (and slightly moved by Yves), 
adding glDepthFunc() calls.


Jeff Lee just raised that this changes also introduced picking problem.

I've never been very confident with the side effects of that changes, so 
Bill (or Yves), can you please clarify why this change was made ?

>From: Jeff Lee <jeff at cdnorthamerica.com>
>To: Sebastien BARRE <sebastien.barre at kitware.com>
>Cc: vtkusers at public.kitware.com
>Subject: [vtkusers] Font rendering / hardware picking
>Thanks Seb,
>The latest change to vtkOpenGLFreeTypeTextMapper.cxx is the source of the 
>picking problems I was seeing since updating.  I saw it because I always 
>had text in the scene when performing the pick.  Symptoms are : when 
>object picked, the most recent actor added to the renderer pops to front 
>in z-buffer, then returns to correct depth on next render.
>Commenting out the lines added in v1.28 correct this problem, but undo 
>what lorensen was trying to fix.  What to do?
>Sebastien BARRE wrote:
>>At 5/22/2003 06:04 AM, aborsic at sc-aip.com wrote:
>>>Dear All,
>>>I'm experiencing a strange problem. I'm posting to check if anybody else has
>>>incurred in anything similar or has any suggestion ragarding the matter.
>>>I'm using VTK on a laptop with windows XP and VS.NET 7.0
>>What is your graphics card ?
>>>In the past I was used to run some python scripts with the original VTK 4.0
>>>distribution from Kitware, and everything was fine.
>>>I have decided thereafter to dowload VTK 4.2.2 and compile it on my machine.
>>>The strange thing is that now the rendering of scenes containing text is
>>>extremely slow.
>>The font rendering engine has been completely reworked in 4.2 and unified 
>>for all platforms.
>>(as a side effect the quality of the text rendered on screen is much 
>>better now, font attributes have been factorized in a vtkTextProperty 
>>class, etc., see http://public.kitware.com/cgi-bin/vtkfaq?req=all#6.14).
>>I made a lot of performance tests at the time the switch was done to make 
>>sure there was no significant hit.
>>Now I see two possible reasons why you would experience this slowdown:
>>a) glPixmap() vs. glBitmap()
>>the old text engine used to rely on calls to OpenGL's glBitmap() to 
>>render text. We are now using glPixmap() by defaul to provide 
>>anti-aliased fonts. Maybe your graphics cards is not optimized for that 
>>particular function. What you can do is disable anti-aliasing globally, 
>>which will make the font engine use glPixmap() (pretty much as it used to 
>>be). In Tcl, put these lines at the beginning of your code:
>>         vtkTextProperty foo
>>         foo SetGlobalAntiAliasingToNone
>>         foo Delete
>>in C++, much easier
>>         vtkTextProperty::SetGlobalAntiAliasingToNone();
>>b) "turn off z-buffering to overlay text" (much less likely)
>>4 months ago a change was made to the engine, and I'm not sure we are all 
>>confident about its side-effects so far.
>>You might want to download the sources, modify 
>>Rendering/vtkOpenGLFreeTypeTextMapper.cxx and rebuild VTK.
>>I would just remove the two lines that were added from revision 1.27 to 1.28:
>>Hope this helps
>>Sebastien Barre

Sebastien Barre

More information about the vtk-developers mailing list