[vtkusers] Opacity of vtkActor2D

dream_noir kyle.charbonneau at gmail.com
Fri Jul 11 11:07:06 EDT 2008


Just to clarify here is a small example program that shows what I am trying
to do:

from vtk import *
import time

video = vtkVideoSource()
video.SetFrameRate(30)
video.SetFrameSize(640, 400, 1)
video.Record()

mapper = vtkImageMapper()
mapper.SetInputConnection(video.GetOutputPort())
mapper.SetColorWindow(233)
mapper.SetColorLevel(138.5)

actor = vtkActor2D()
actor.GetProperty().SetOpacity(0.3)
actor.SetMapper(mapper)

cone = vtkConeSource()
cone.SetHeight( 3.0 )
cone.SetRadius( 1.0 )
cone.SetResolution( 10 )

coneMapper = vtkPolyDataMapper()
coneMapper.SetInputConnection( cone.GetOutputPort() )

coneActor = vtkActor()
coneActor.SetMapper( coneMapper )

ren = vtkRenderer()
ren.AddActor2D(actor)
ren.AddActor(coneActor)

renWind = vtkRenderWindow()
renWind.AddRenderer(ren)

for i in range (0, 2000):
    time.sleep(0.03)
    renWind.Render()


You can't see the cone behind the video source despite setting the opacity.
Any ideas?


dream_noir wrote:
> 
> I have a vtkActor2D object .that I'm putting a video source in to display
> in my app. I add this actor to a renderer with the AddActor2D method. Now
> I want this Actor2D to be transparent so I can see the scene behind it.
> Unfortunately, using the GetProperty()/SetProperty() methods to get or set
> the Property2D object and change the opacity there does nothing. The video
> is still opaque and completely blocks the scene behind it. What can I do?
> Is this a bug or am I going about it wrong?
> 

-- 
View this message in context: http://www.nabble.com/Opacity-of-vtkActor2D-tp18385577p18405991.html
Sent from the VTK - Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080711/82b18782/attachment.htm>


More information about the vtkusers mailing list