<div><div class="gmail_quote">On Mon, Oct 26, 2009 at 10:19 PM, David Feng <span dir="ltr"><<a href="mailto:dfeng@cs.unc.edu">dfeng@cs.unc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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:<br>

<br>
 // don't accept fragments if they have zero opacity. this will stop the<br>
 // zbuffer from be blocked by totally transparent texture fragments.<br>
 glAlphaFunc (GL_GREATER, static_cast<GLclampf>(0));<br>
 glEnable (GL_ALPHA_TEST);<br>
<br>
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.<br>

<br>
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?<br><br></blockquote><div>
<br></div><div>The issue we have run into several times with the gradient background is that mappers/actors in VTK do not always reset their state after rendering. It is not textures in general since I've used textures with a gradient background before (e.g. in vtkGeoView).</div>
<div><br></div>I believe the text mapper draws pixels directly on the screen, so they are always constant size. The text actor renders a texture to a quad in the scene, which is why it can scale.</div><div class="gmail_quote">
<div><br></div><div>Jeff<br><br></div></div>
</div>