[vtkusers] mapper SetResolveCoincidentTopologyToShiftZBuffer - Does this work ?
David Netherway
david.netherway at adelaide.edu.au
Thu Nov 21 22:20:35 EST 2002
Hello,
I am trying to have 3D lines always appear in front of other geometry and
volume ray cast images.
I thought to use mapper->SetResolveCoincidentTopologyToShiftZBuffer.
I have added a few test lines at the end of the disk.tcl demo - see below.
ResolveCoincidentTopologyToShiftZBuffer uses a function in
vtkOpenGlPolyDataMapper.cxx that maps the depth of the actor to a restriced
z range:
glDepthRange(zRes, 1.);
I map the line to the range 0.8 - 1.0 so that the line should always appear
in front when the camera is rotated but this is not the case for me.
I am using an NVIDIA GeForce 256 graphics card. The card may not be
implementing glDepthRange.
Does anyone get the expected behaviour?
There is no test presently in vtk that tests this method. (My version is a
nightly CVS of about 3 months ago).
Thanks, David
# disk.tcl demo
package require vtk
package require vtkinteraction
# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkDiskSource disk
disk SetInnerRadius 1.0
disk SetOuterRadius 2.0
disk SetRadialResolution 1
disk SetCircumferentialResolution 20
vtkPolyDataMapper diskMapper
diskMapper SetInput [disk GetOutput]
vtkActor diskActor
diskActor SetMapper diskMapper
# Add the actors to the renderer, set the background and size
#
ren1 AddActor diskActor
ren1 SetBackground 0.1 0.2 0.4
renWin SetSize 200 200
# Get handles to some useful objects
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
renWin Render
# prevent the tk window from showing up then start the event loop
wm withdraw .
#----------added test code----------------------------
vtkLineSource testLine
testLine SetPoint1 0 0 0
testLine SetPoint2 2.5 0.0 1.0
vtkPolyDataMapper testLineMapper
testLineMapper SetInput [testLine GetOutput]
vtkActor testLineActor
testLineActor SetMapper testLineMapper
[testLineActor GetProperty] SetColor 1.0 0.0 0.0
ren1 AddActor testLineActor
testLineMapper SetResolveCoincidentTopology 1
testLineMapper SetResolveCoincidentTopologyToShiftZBuffer
testLineMapper SetResolveCoincidentTopologyZShift 0.8
#---- end test code --------------------------------
More information about the vtkusers
mailing list