[vtkusers] Volume Rendering, cell mode, and rotation optimization - VTK macro bug/issue?
Richard Frank
rickfrank at me.com
Sat May 18 16:51:58 EDT 2013
On researching my previous question about how the volume rendering is made lower resolution during rotation,
I did some tracing of the code, and found what I believe is a problem related to a Macro.
This is the section of code that determines whether the sampling distance is computed on the fly for the GPURenderMode:
case vtkSmartVolumeMapper::GPURenderMode:
...
usedMapper->SetAutoAdjustSampleDistances(
ren->GetRenderWindow()->GetDesiredUpdateRate()>=
this->InteractiveUpdateRate);
usedMapper->Render(ren, vol);
break;
Here it seems that SetAutoAdjustSampleDistance(int) if passed 0 will turn off auto adjusting sampling distance.
If I look at
ren->GetRenderWindow()->GetDesiredUpdateRate() it is equal to 0.0001;
this->InteractiveUpdateRate == 1.0;
so, GetDesiredUpdateRate is not greater than or equal to InteractiveUpdateRate,
and so SetAutoAdjustSampleDistances() should be passed 0 (or false) and turned off.
But it's not.
SetAutoAdjustSampleDistance is defined as some macros
/ Description:
// If AutoAdjustSampleDistances is on, the the ImageSampleDistance
// will be varied to achieve the allocated render time of this
// prop (controlled by the desired update rate and any culling in
// use).
vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
vtkGetMacro( AutoAdjustSampleDistances, int );
vtkBooleanMacro( AutoAdjustSampleDistances, int );
if I change the code to
int val = ren->GetRenderWindow()->GetDesiredUpdateRate()>=
this->InteractiveUpdateRate;
usedMapper->SetAutoAdjustSampleDistances(val);
val is 0 and still doesn't turn it off.
HOWEVER if I change the code to
usedMapper->SetAutoAdjustSampleDistances(0);
IT WORKS - the Auto Adjustment is off and I get smooth rotations.
Seems odd to me, and perhaps a bug with the macro definition?
I'm using Windows Visual Studio 7, but we also see this on Ubuntu Linux with gcc
Can someone verify?
Thanks
Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130518/7399d8f6/attachment.htm>
More information about the vtkusers
mailing list