[vtkusers] Problem when using vtkFlRenderWindowInteractor and Widget

Cuong cuong.nguyen111 at gmail.com
Wed Jun 29 00:58:31 EDT 2011


Hi,

I tried to modify the cone3 example of the vtkFlRenderWindowInteractor
class. I want to add a box widget to be able to scale or translate the cone,
but when I run the program, everytime I hover the mouse over the "flrwi"
window I encountered a null pointer error.

Here's what I added in the create_cone_pipeline(vtkFlRenderWindowInteractor
*flrwi) function

  //create a cone, the actor is "coneActor"
  //add this actor to the renderer
  flrwi->SetRenderWindow(renWindow); //flrwi is the
vtkFlRenderWindowInteractor 

  //widget
  vtkSmartPointer<vtkBoxWidget> boxWidget = 
    vtkSmartPointer<vtkBoxWidget>::New();
  boxWidget->SetInteractor(flrwi); //I think there is something wrong here
  boxWidget->SetPlaceFactor(1.25);
 
  boxWidget->SetProp3D(coneActor);
  boxWidget->PlaceWidget();
  vtkSmartPointer<vtkMyCallback> callback =
    vtkSmartPointer<vtkMyCallback>::New();
  boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);
 
  boxWidget->On();

  flrwi->Initialize();

  //clean up

I'd be very appreciative for any help or hints.
Thank you so much,
- Cuong

--
View this message in context: http://vtk.1045678.n5.nabble.com/Problem-when-using-vtkFlRenderWindowInteractor-and-Widget-tp4534110p4534110.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list