[vtkusers] Destroying a vtkWin32OpenGLRenderWindow

Phil Goddard philgoddard at telus.net
Mon Aug 4 20:34:20 EDT 2008


The following code is the part that generates the render window:

vtkRenderer *renderer = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
vtkInteractorStyleTrackballCamera *style =
vtkInteractorStyleTrackballCamera::New();

renWin->AddRenderer(renderer);
iren->SetRenderWindow(renWin);
iren->SetInteractorStyle(style);

// Add the actors
renderer->AddActor(sgridActor);
renderer->AddActor(scalarBar);

// Create a bounding box
vtkCubeAxesActor2D *bbox = vtkCubeAxesActor2D::New();
bbox->SetViewProp(sgridActor);
bbox->SetCamera(renderer->GetActiveCamera());
bbox->SetFlyModeToOuterEdges();
renderer->AddViewProp(bbox);

// Set camera view
renderer->ResetCamera(0,nx,0,ny,0,nz);
renderer->GetActiveCamera()->Elevation(45.0);
renderer->GetActiveCamera()->Azimuth(30.0);
renderer->GetActiveCamera()->Zoom(0.85);

// Do the rendering
renWin->Render();


I should also add that the code is being run inside an inprocess dll from
another application.
(I am writing the dll, and it only contains the above code and the code that
generates sgridActor and scalarBar prior to the above code and appropriate
->Delete routines for the vtk objects.)

Any help's appreciated.
Phil.


________________________________

	From: David Cole [mailto:david.cole at kitware.com] 
	Sent: August 4, 2008 7:57 AM
	To: Phil Goddard
	Cc: vtkusers at vtk.org
	Subject: Re: [vtkusers] Destroying a vtkWin32OpenGLRenderWindow
	
	
	Send some code demonstrating your use of the vtkRenderWindow.
Usually, the default vtkRenderWindowInteractor will take care of closing the
render window when the user clicks on the close "x"... 

	Maybe you have a custom interactor that is not handling everything
that the default one does?
	
	

	On Fri, Aug 1, 2008 at 6:19 PM, Phil Goddard <philgoddard at telus.net>
wrote:
	


		I'm creating a vtkWin32OpenGLRenderWindow via a call to
vtkRenderWindow
		without passing in a HWND so that a "default" window is
created.
		However the close button (the X in the top right hand
corner) doesn't seem
		to be hooked up.
		
		There is some code in the MessageProc method that uses
WM_DESTROY, however
		this never gets called.
		
		Is this expected behaviour?
		Is there a simple way to get a render window created in this
way to be
		destroyed when the close button is pressed?
		
		Thanks
		Phil.
		
		
		
		_______________________________________________
		This is the private VTK discussion list.
		Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
		Follow this link to subscribe/unsubscribe:
		http://www.vtk.org/mailman/listinfo/vtkusers
		







More information about the vtkusers mailing list