vtkSmartVolumeMapper does not change color function in GPU mode
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
This issue is for VTK 5.10.0
Changing the vtkColorTransferFunction of a vtkSmartVolumeMapper object will have no effect after the first render, if render mode is GPU-based (which is the default)
I have attached a case test, where one vtkSmartVolumeMapper and two diferent color transfer functions are defined. There are 4 lines of code of interest, marked as TESTLINE1 .. TESTLINE4
// Render composite. In default mode. For coverage. //TESTLINE1 renWin->Render();
//Change color function to green //TESTLINE2 volumeProperty->SetColor(color2);
//Change render to software mode //TESTLINE3 volumeMapper->SetRequestedRenderModeToRayCast(); renWin->Render();
//Change render to default (GPU) mode //TESTLINE4 volumeMapper->SetRequestedRenderModeToDefault(); renWin->Render();
This example define a color transfer function in red values. The TESTLINE2 changes it to another color in green values. The expected result should be to see a sphere with green color, but the original red color is used.
Disabling TESTLINE1, so initial GPU render is avoided, will produce the correct behavior.
Disabling TESTLINE4 (so CPU raycast is used) will also produce correct behavior, even if TESTLINE1 is enabled.
So it seems that GPU based renderer is not changing the color transfer function after the first call to render(). Doing a explicit call to volume->UpdateTransferFunctions(ren1) does not help to solve the problem.