Reputation: 101
Current Setup:
gridRenderer->SetLayer(0);
geoRenderer->SetLayer(1);
RenderWindow()->SetNumberOfLayers(2);
RenderWindow()->AddRenderer(geoRenderer);
RenderWindow()->AddRenderer(geoRenderer);
gridRenderer->SetActiveCamera(geoRenderer->GetActiveCamera());
This successfully allows me to have a grid in the background, with a geometry in the foreground.
Problem:
Similar Issue:
The difference between my issue and this one is that I am updating both the gridRender's and geoRenderer's actors, sometimes removing all of the actors within a renderer entirely (empty renderer could mess up the clipping planes, not rendering anything, if the camera chooses it as the active renderer).
My assumption is that VTK is confused as to which renderer to use in order to set the shared camera's clipping planes. I tried using vtkRenderer::ResetCameraClippingRange()
on both of the renderer's but cannot get the clipping planes to form properly
Is there someway I can tell VTK which renderer to look at when resetting the clipping planes/camera?
Update:
ComputeVisiblePropBounds
calls, along with disabling
vtkInteractorStyle::AutoAdjustCameraClippingRange
as such:double geoCB[6];
double gridCB[6];
geoRenderer->ComputeVisiblePropBounds(geoCB);
gridRenderer->ComputeVisiblePropBounds(gridCB);
double finalCB[6];
for (int i = 0; i < 6; i++) {
if (i % 2 == 0) {
// Even Index is Min
if (geoCB[i] < gridCB[i]) {
finalCB[i] = geoCB[i];
} else {
finalCB[i] = gridCB[i];
}
} else {
// Odd Index is Max
if (geoCB[i] > gridCB[i]) {
finalCB[i] = geoCB[i];
} else {
finalCB[i] = gridCB[i];
}
}
}
geoRenderer->ResetCameraClippingRange(finalCB);
Unfortunately this still does not work properly at all...
Upvotes: 1
Views: 942
Reputation: 101
Important Update:
RenderWindow->Render()
.vtkRenderWindow
, I simply needed to overrride Render()
, putting the above code inside, and then finisihing the ovveride with a call to the default Render()
Upvotes: 0
Reputation: 1337
Maybe you can set the clipping range explicitly to large values with:
vtkCamera.SetClippingRange(x0,x1)
Upvotes: 1