[vtkusers] Using VTK in an existing OpenGL window

Charl P. Botha c.p.botha at its.tudelft.nl
Tue Mar 11 12:41:20 EST 2003


On Tue, 2003-03-11 at 18:32, Arun Kumar Srinivasan wrote:
>     I noticed your reply in vtk mailing list for using VTK in an 
> existing OpenGL window...
> >You could pass the window ID of the configured Window to the
> >vtkRenderWindow::SetWindowId() call, followed by a Render().  
> >Have a
> >look at
> >some of the widgets that combine VTK with the various widget sets 
> >to
> >see how
> >this works.
>      When I tried to do this, I got the following message:
> objects.cpp(107) : error C2039: 'SetWindowID' : is not a member of 
> 'vtkRenderWindow'

That's because I said SetWindowId() and NOT SetWindowID().

>       My code has the following lines:
>  	wid=glutGetWindow();  // wid is an int
>         ....
> 
>  	ren=vtkRenderer::New();
>  	renwin=vtkRenderWindow::New();
>  	renwin->SetWindowID(wid);
>  	iren = vtkRenderWindowInteractor::New();
>  	renwin->AddRenderer(ren);
>  	iren->SetRenderWindow(renwin);
>  	for (i=0;i<3;i++)
>  		ren->AddActor(objs[i]);
>  	renwin->Render();
>  	iren->Start();

Why are you doing this?  Wouldn't it be easier to use one of the
existing VTK<->Widget Library classes?

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/



More information about the vtkusers mailing list