[vtkusers] who 'observes' event?
Amy Henderson
amy.henderson at kitware.com
Wed Jun 2 11:58:25 EDT 2004
Please keep the discussion on the mailing list.
The problem is that there has to be an event loop for events to be
processed. You either have to use iren->Start() or write your own event
loop. The problem is not in the interactor style; events are sent to the
interactor style from the render window interactor. From
vtkRenderWindowInteractor.h:
// vtkRenderWindowInteractor provides a platform-independent interaction
// mechanism for mouse/key/time events. It serves as a base class for
// platform-dependent implementations that handle routing of mouse/key/timer
// messages to vtkInteractorStyle and its subclasses.
// vtkRenderWindowInteractor also provides controls for picking,
// rendering frame rate, and headlights.
- Amy
At 11:52 AM 6/2/2004, you wrote:
>So I guess this is the problem then..? How do I get around this? Now am I
>supposed to make my own InteractorStyle? Or is there a simpler way to go
>about this..?
>
>Below is the structure of my code (I am just switching between two scenes,
>the "AnImportantFunction()" updates/modifies data in one renderer, and the
>"AnotherImportantFunction" modifies data in the ohter renderer)
>
>
>CallbackCommand->SetCallback( MyClass::DoStuff(0 );
>Iren->AddObserver( vtkCommand::KeyPressEvent, CallbackCommand );
>
>int sample = 0;
>while(1)
>{
>
> if ( Flag == 0 )
> {
> AnImportantFunction( sample );
> Iren->Render();
> sample++;
> }
> else
> {
> AnotherImportantFunction( sample );
> sample++;
> Iren->Render();
>
> }
>
>}
>
>
>
>void MyClass::DoStuff( vtkObject* caller, unsigned long eid, void*
>clientdata, void* calldata)
>{
>
> cout<<Flag <<endl;
>
> Flag = !Flag;
>
>
>return;
>}
>
>_________________________________________________________________
>Get fast, reliable Internet access with MSN 9 Dial-up now 3 months FREE!
>http://join.msn.click-url.com/go/onm00200361ave/direct/01/
More information about the vtkusers
mailing list