Post-newbie Q: C++ callbacks in custom vtk event loop ???

Audrius Stundzia adv_biologic at excite.com
Tue Jun 29 17:42:56 EDT 1999


Dear vtker's

After updating my vtk version to the latest nightly release the code below
to rotate an isosurface in response to a mouse click and drag compiles.

However, when I run the code I get exactly nothing in response to my left
mouse button click and drag. If I use the default Initialize and Start
vtkRenderWindowInteractor, the isosurface rotates happily in response to 
the mouse command.

Any help would be most appreciated.

Regards, 

Audrius

The code fragment:

//-----Callback variables and static functions

int  lastXYPosition[2];
int *pLastXYPosition = lastXYPosition;

static void RotateCallBack( void *arg) 
{ 
  vtkRenderWindowInteractor *interactor = (vtkRenderWindowInteractor *)arg;
  
  pLastXYPosition = interactor->GetEventPosition();
  
  interactor->StartRotate();
}

static void NullCallBack( void *arg)
{ 

}

static void LeftButtonPressedCallBack( void *arg) 
{
  vtkRenderWindowInteractor *interactor = (vtkRenderWindowInteractor *)arg;
  
  pLastXYPosition = interactor->GetEventPosition();
  
  interactor->SetTimerMethod( RotateCallBack
                            , (void *) interactor );
  interactor->StartTimer();
}

static void LeftButtonReleasedCallBack(  void *arg)
{
  vtkRenderWindowInteractor *interactor = (vtkRenderWindowInteractor *)arg;
  
  interactor->EndTimer();
  interactor->SetTimerMethod( NullCallBack
                            , (void *) interactor );
  
  pLastXYPosition = interactor->GetEventPosition();
}

 . . . in the body of the code  . . .


//-----Rendering loop

while(1)
{   
   myInteractor->SetEventPosition( lastXYPosition);

   myWindow->Render();
} 
   




_______________________________________________________
Get your free, private email at http://mail.excite.com/


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list