[vtkusers] Multiple viewports on win2k
Evert Koopman
e.a.koopman at chello.nl
Mon Oct 1 15:12:39 EDT 2001
I tried using 2 renderers in a single window using the code listed below.
But only the cone in ren2 is drawn, the other half of the window starts out
black and it won't be redrawn (ie when you move another window over it it
will not get black again but a residual image of the dragged window remains.
So far i tried varying the order in which i add the renderers, set the
background and define the viewport, all to no avail. I use the vtkNightly
version of last week monday, am running win2000 professional, compile using
VC++ 6.0, have a Matrox G400 32MB video card with latest drivers and use a
desktop resolution of 1600x1200 24bpp.
Thanks if anyone can have a look and hint at a sollution.
Evert Koopman
----------------------------------------------------------------------------
------------------------------------------------------------
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkCubeSource.h"
#include "vtkConeSource.h"
void main( int argc, char *argv[] )
{
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderer *ren2 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
renWin->AddRenderer(ren2);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkCubeSource *cube = vtkCubeSource::New();
vtkConeSource *cone = vtkConeSource::New();
vtkPolyDataMapper *cubeMapper = vtkPolyDataMapper::New();
vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
cubeMapper->SetInput(cube->GetOutput());
coneMapper->SetInput(cone->GetOutput());
vtkActor *cubeActor = vtkActor::New();
vtkActor *coneActor = vtkActor::New();
cubeActor->SetMapper(cubeMapper);
coneActor->SetMapper(coneMapper);
ren1->AddActor(cubeActor);
ren2->AddActor(coneActor);
ren1->SetBackground(0.5, 0.5, 0.5);
ren2->SetBackground(1.0, 1.0, 1.0);
ren1->SetViewport(0.0, 0.0, 0.5, 1.0);
ren2->SetViewport(0.5, 0.0, 1.0, 1.0);
renWin->SetSize(400, 400);
renWin->Render();
iren->Start();
}
More information about the vtkusers
mailing list