[vtkusers] Transparent Renderer

Patrick Lagace plagace at giref.ulaval.ca
Thu Jul 20 11:18:11 EDT 2000


> Hi,
>      Is there a way to create a transparent renderer ? What I need to do is
> to create 2 or more renderers, one is main renderer and all others on top
> of it and their background are transparent.
>      Thank you in advance!

I don't think vtkRenderer gives directly the the possibility to do that (it may be an
interesting new feature for VTK?  I mean, be able to "disable" the color buffer clear for any
given renderer).


I have a little quick fix for that (if you use vtk under C++):  create a subclass of
vtkOpenGLRenderer and override the "vtkOpenGLRenderer::Clear()" with your own copy, in which
you modify the glClear call so that it does not clear the color buffer:

glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)       ->        gl(GL_DEPTH_BUFFER_BIT)

Use this class for the "transparent" renderer.  This is a bit dirty (If you use Mesa, you have
to use vtkMesaRenderer instead...) but it's working.
Caution:  Be certain to draw your "main" renderer before the transparent one.


Patrick Lagace
plagace at giref.ulaval.ca





More information about the vtkusers mailing list