[vtkusers] animation loop and interaction

Akshay Sthapit sthapit at yahoo.com
Wed Aug 18 12:10:02 EDT 2004


Hi Alex

What I have done is to add an observer to renderer -

renderer->AddObserver(vtkCommand::StartEvent, myVtkCB);

That way it keeps updating the scene (via a "callback") at a rate which
you can control, and all you have to do is manipulate ("interact") the
actors in another thread, and tadaa you got animation.

Here's my vtkCB class -

class vtkCB : public vtkCommand {//Callback to update at every graphics
loop
	public:
		static vtkCB *New() {
			return new vtkCB; 
		}
		virtual void Execute(vtkObject *caller, unsigned long, void*
callData) {
			graphicsInterface->refresh();
		}
		void setup(GraphicsInterface *graphicsInterface) {
			this->graphicsInterface = graphicsInterface;
		}
	private:
			GraphicsInterface *graphicsInterface;
};

Hope this helps.

Akshay


--- Alexandre Popelard <apopelar at enserg.fr> wrote:

> Hi,
> 
> I have developed a little volume animation under c++ using a simple
> loop.
> I would now want to be able to interact with the volume during the 
> animation. But if I use vtkRenderWindowInteractor and start(), it
> stops the 
> main animation loop.
> If you have any ideas or examples on how to do that, please let me
> know.
> 
> Thanks,
> Alex
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the vtkusers mailing list