[vtkusers] Change the vtkColorTransferFunction of a vtkSmartVolumeMapper

Jose Miguel Espadero josemiguel.espadero at urjc.es
Tue Oct 23 12:48:59 EDT 2012


Hi VTKuser,

I'm trying to write a program with VTK 5.10.0 which will render a volume
using
different color transfer functions (I will change it with the keyboard)

I use a vtkSmartVolumeMapper to use GPU rendering if possible, and fall to
CPU raycast if not available.

The problem is that changing the color transfer function is not working if a
GPU is present. It will accept any vtkColorTransferFunction, but after doing
a first render, changing the color transfer will have no effect.
This problem is not present if GPU acceleration is disabled by calling to
SetRequestedRenderModeToRayCast().

So I attach a minimal example. I will render a sphere in red color, then
change the
vtkColorTransferFunction to green and do another render. I expected to see
the
sphere in green, but I get the sphere in red.

The change of color is done in line marked as TESTLINE2, and will not work
if
the render() call in TESTLINE1 is executed. Disabling TESTLINE1 will
produce
the desired color.

Does anybody know a method to change the color function after an initial
render?

Thanks for your ideas...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121023/522883a8/attachment.htm>
-------------- next part --------------
cmake_minimum_required(VERSION 2.6)
 
PROJECT(SmartVolumeMapper)
 
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
 
ADD_EXECUTABLE(SmartVolumeMapper SmartVolumeMapper.cxx)
 
TARGET_LINK_LIBRARIES(SmartVolumeMapper vtkHybrid vtkVolumeRendering)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SmartVolumeMapper.cxx
Type: application/octet-stream
Size: 4884 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121023/522883a8/attachment.obj>


More information about the vtkusers mailing list