[vtkusers] Font rendering performance issues with VTK 4.2.2/win XP/.NET

Sebastien BARRE sebastien.barre at kitware.com
Thu May 22 09:49:36 EDT 2003


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:
http://public.kitware.com/cgi-bin/cvsweb.cgi/VTK/Rendering/vtkOpenGLFreeTypeTextMapper.cxx.diff?r1=1.27&r2=1.28&cvsroot=VTK

Hope this helps

--
Sebastien Barre





More information about the vtkusers mailing list