[vtk-developers] vtkTextActor (and vtkTextures?) with gradient backgrounds
David Feng
dfeng at cs.unc.edu
Mon Oct 26 22:19:27 EDT 2009
It looks vtkTextActor doesn't play well with gradient backgrounds. The
background disappears entirely when I add a vtkTextActor to my renderer,
which is embedded in a vtkRenderView. I suspect it's because
vtkTextActor uses a vtkTexture, which enables GL_ALPHA_TEST (in the
OpenGL version). The background is rendered as a 0.0 alpha colored quad
(when gradient backgrounds are enabled), and the alpha function is
discarding all 0.0 alpha fragments for the following reason:
// don't accept fragments if they have zero opacity. this will stop the
// zbuffer from be blocked by totally transparent texture fragments.
glAlphaFunc (GL_GREATER, static_cast<GLclampf>(0));
glEnable (GL_ALPHA_TEST);
Simply adding glDisable(GL_ALPHA_TEST) to the PostRender method didn't
seem to affect my output, so my diagnosis could be wrong. If it is
something along these lines, I'm seems like all vtkTextures will clobber
gradient backgrounds.
Regardless, it looks like vtkTextMapper doesn't cause these problems, so
I'll be switch to that for now. Does anyone know of a simple way to
have the vtkTextMapper scale with viewport size?
Thanks,
David
More information about the vtk-developers
mailing list