[vtkusers] Multiple Render Windows

Lisa Avila lisa.avila at kitware.com
Tue Feb 24 23:40:08 EST 2004


Hello Markus,

Since you include the same mapper in two different render windows, you need 
to use immediate mode rendering (ImmediateModeRenderingOn on the mapper). 
Display lists are built for a particular OpenGL context and you are trying 
to use it in two different ones....

Lisa


At 01:15 PM 2/24/2004, Christopher.Moore at noaa.gov wrote:

>Hi Markus,
>
>It's nice that you included the simple (complete) sample code with your
>email.  I was able to quickly compile it on my machine (VTK 4.2, Redhat
>9.0, Nvidia driver/Quadro 550) and it doesn't show the problem you are
>having.  The Sphere remains visible as the Cone actors happily spin around
>in both windows.
>
>Are you using Mesa or hardware-accelerated OpenGL?  Seems the only
>difference between our systems is RH version, and opengl...
>
>Best of luck,
>Chris Moore - NOAA Seattle
>
>On Tue, 24 Feb 2004 duke123 at gmx.net wrote:
>
> > Dear VTKers,
> >
> > I am a new VTK user (VTK 4.2, Redhat 7.2) and am currently experiencing a
> > strange problem. I am using a Sensable Phantom device, along with VTK for
> > haptic and graphic rendering. I have some medical volume data with 
> segmented
> > bones, represented as vtkVolume and a vtkActor for each segment (as 
> polygonal
> > mesh).
> >
> > In my application I want to use 2 render windows, one displaying a volume
> > rendering of the volume, and the other one displaying the segmented bones,
> > which are touchable by the phantom. The current phantom position is 
> shown by a
> > cursor (vtkActor).
> >
> > Since volume rendering takes some time, the "volume window" needs only be
> > re-rendered when the camera position has changed, whereas the "main window"
> > shall be redrawn as fast as possible, since it contains the phantom 
> cursor.
> >
> > The problem I have, is that some actors which are present in the "main
> > window" disappear, as soon as the "volume window" is rendered. This 
> problem can be
> > solved by adding all actors to both windows. But I don't want to do that.
> >
> > I have put together a simple example highlighting my problem (sources 
> at the
> > end of this mail). In this example, there are two cones and one sphere and
> > two render windows. The first window contains only  one cone, whereas the
> > other window contains a cone and the sphere. When both windows are 
> rendered for
> > the first time, all actors are drawn. If the windows are rendered 
> again, the
> > sphere disappears. If the cone is removed from the second window, so 
> that this
> > window only contains the sphere, the sphere is rendered.
> >
> > I have checked how many actors are rendered ( GetNumberOfPropsRendered() )
> > and two actors are reported, although only one is visible.
> >
> > I hope that this problem is because I made a stupid mistake, since I am new
> > to VTK.
> > Anyways, thanks for your help.
> >
> >
> > Markus
> >
> >
> > Here is the example C++ code.
> >
> >
> > #include "vtkSphereSource.h"
> > #include "vtkConeSource.h"
> > #include "vtkPolyDataMapper.h"
> > #include "vtkActor.h"
> > #include "vtkRenderer.h"
> > #include "vtkRenderWindow.h"
> > #include "vtkCamera.h"
> > #include "vtkRenderWindowInteractor.h"
> > #include "vtkProperty.h"
> >
> >
> > void main( int argc, char *argv[] )
> > {
> >
> >   vtkConeSource *cone = vtkConeSource::New();
> >   cone->SetHeight( 3.0 );
> >   cone->SetRadius( 1.0 );
> >   cone->SetResolution( 10 );
> >
> >
> >
> >   vtkSphereSource *sphere = vtkSphereSource::New();
> >   sphere->SetRadius(5.0);
> >   sphere->SetThetaResolution(20);
> >   sphere->SetPhiResolution(20);
> >   sphere->SetCenter(-10,0,5);
> >
> >   vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
> >   coneMapper->SetInput( cone->GetOutput() );
> >
> >   vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
> >   sphereMapper->SetInput( sphere->GetOutput() );
> >
> >
> >
> >   vtkActor *coneActor = vtkActor::New();
> >   coneActor->SetMapper(coneMapper);
> >   coneActor->GetProperty()->SetColor(0, 0, 1);
> >   coneActor->GetProperty()->SetInterpolationToPhong();
> >
> >   vtkActor *sphereActor = vtkActor::New();
> >   sphereActor->SetMapper( sphereMapper );
> >   sphereActor->SetOrigin(0,0,0);
> >
> >   vtkRenderWindow *renWin = vtkRenderWindow::New();
> >   vtkRenderWindow *renWin2 = vtkRenderWindow::New();
> >
> >   vtkRenderer *ren1= vtkRenderer::New();
> >   ren1->AddActor(coneActor );
> >   ren1->SetBackground( 1,1,1 );
> >
> >   vtkRenderer *ren2= vtkRenderer::New();
> >
> >    // if the following line is uncommented, it works
> >   ren2->AddActor(coneActor);
> >   ren2->AddActor(sphereActor);
> >   ren2->SetBackground( 1,1,1 );
> >
> >
> >   renWin->AddRenderer( ren1 );
> >   renWin2->AddRenderer( ren2 );
> >
> >   renWin->SetSize( 400, 300 );
> >   renWin2->SetSize( 400, 300 );
> >   renWin2->SetPosition(0,350);
> >
> >
> >   // Loop over 360 degrees and render both windows each time.
> >
> >   for (int i = 0; (i % 360) < 360; i++) {
> >
> >     renWin->Render();
> >     renWin2->Render();
> >     coneActor->SetOrientation(i,0,0);
> >   }
> >
> > }
> >
> >
> >
> > --
> > GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
> > jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ 
> http://www.gmx.net/derspiegel +++
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at: 
> <http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list