[vtkusers] Font rendering / hardware picking

Jeff Lee jeff at cdnorthamerica.com
Thu May 22 10:31:51 EDT 2003


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?
-Jeff

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:
> 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
>
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>

-- 
Jeff Lee
Software Engineer
Computational Dynamics North America Ltd
21 Lafayette Street, Suite 230
Lebanon NH 03766 USA
fax:   603 643 9994
phone: 603 643 9993 x109
http://www.cd-adapco.com





More information about the vtkusers mailing list