[vtkusers] Strange rendering with multiple renderers sharing a camera
CharlesB
chbrossotaf at gmail.com
Wed Aug 16 08:57:18 EDT 2017
Hello,
I have two renderers in a render window, because I need overlay actors to
be always front. They share the same camera, in order to be moved together
with user interaction.
The issue is that the actor is only partially rendered when user moves the
camera in the scene, as if the front and the back of it was disappearing.
I see this with VTK 7.1 and 8.0.
Is there something special to do to avoid this? Or did I find a bug?
[image: Images intégrées 1]
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkPolyData.h>
#include <vtkPlaneSource.h>
#include <vtkInteractorStyleTrackballCamera.h>
int main(int, char*[])
{
auto plane_source = vtkSmartPointer<vtkPlaneSource>::New();
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(plane_source->GetOutputPort());
auto actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
auto renderer = vtkSmartPointer<vtkRenderer>::New();
auto overlay_renderer = vtkSmartPointer<vtkRenderer>::New();
renderer->SetLayer(0);
overlay_renderer->SetLayer(1);
auto render_window = vtkSmartPointer<vtkRenderWindow>::New();
render_window->SetNumberOfLayers(2);
render_window->AddRenderer(renderer);
render_window->AddRenderer(overlay_renderer);
auto camera = vtkSmartPointer<vtkCamera>::New();
renderer->SetActiveCamera(camera);
overlay_renderer->SetActiveCamera(camera);
renderer->AddActor(actor);
renderer->ResetCamera();
auto render_window_interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
auto trackball_style =
vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
render_window_interactor->SetRenderWindow(render_window);
render_window_interactor->SetInteractorStyle(trackball_style);
render_window->Render();
render_window_interactor->Start();
return EXIT_SUCCESS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170816/c8b050ed/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 27561 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170816/c8b050ed/attachment.png>
More information about the vtkusers
mailing list