ActiViz | vtkRenderWindowInteractor Start event

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiViz | vtkRenderWindowInteractor Start event

Matimont
Hi,

I noticed when I create a vtkRenderWindowInteractor and I start it, then my program stays at the line where I declare the start, here's sample code:

                vtkRenderer render = vtkRenderer.New();
                vtkRenderWindow renwin = vtkRenderWindow.New();
                renwin.AddRenderer(render);
                vtkRenderWindowInteractor iren = vtkRenderWindowInteractor.New();
                iren.SetRenderWindow(renwin);
                iren.Start();
                ...
                ...
                //Do More Stuff

So, until I close the window that pop ups, my program doesn't goes further, how can I avoid this behavior?

Thanks!

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: ActiViz | vtkRenderWindowInteractor Start event

David Cole-2
iren.Start(); runs a message loop, and doesn't exit until you as a user
exit that window (either press the 'q' key, or close the window)

If you don't want that because you're building this into an application
where you already have your own message loop, then simply don't call
iren.Start();...

Instead, call "renwin.Render();" to show the window and render its
contents. If you're running in the context of a WinForms application,
or something like it, then your message loop should suffice to cause
events to be processed for the render window.


HTH,
David C.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: ActiViz | vtkRenderWindowInteractor Start event

Matimont
Hi David, thanks for the response.

I'm using this into a Windows Form Application. What would be my message loop? I'm not quite sure what that means, can you explain a bit more?

Thanks!


On Sat, Mar 29, 2014 at 1:59 PM, David Cole <[hidden email]> wrote:
iren.Start(); runs a message loop, and doesn't exit until you as a user exit that window (either press the 'q' key, or close the window)

If you don't want that because you're building this into an application where you already have your own message loop, then simply don't call iren.Start();...

Instead, call "renwin.Render();" to show the window and render its contents. If you're running in the context of a WinForms application, or something like it, then your message loop should suffice to cause events to be processed for the render window.


HTH,
David C.



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: ActiViz | vtkRenderWindowInteractor Start event

David Cole-2
Do you have a "main"?

Are you calling "Application::Run(form);"?

WinForms will run a message loop for you if you call the Application
Run method. In that sense, it does exactly the same thing conceptually
as vtkRenderWindowInteractor::Start.

The message loop usually looks something like this, if you look at the
source code for one:

    while (GetMessage(&msg, ...))
    {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }

http://en.wikipedia.org/wiki/Message_loop_in_Microsoft_Windows


HTH,
David


-----Original Message-----
From: Matias Montroull <[hidden email]>
To: David Cole <[hidden email]>
Cc: vtkusers <[hidden email]>
Sent: Mon, Mar 31, 2014 8:56 pm
Subject: Re: [vtkusers] ActiViz | vtkRenderWindowInteractor Start event


Hi David, thanks for the response.


I'm using this into a Windows Form Application. What would be my
message loop? I'm not quite sure what that means, can you explain a bit
more?


Thanks!





On Sat, Mar 29, 2014 at 1:59 PM, David Cole <[hidden email]> wrote:

iren.Start(); runs a message loop, and doesn't exit until you as a user
exit that window (either press the 'q' key, or close the window)

If you don't want that because you're building this into an application
where you already have your own message loop, then simply don't call
iren.Start();...

Instead, call "renwin.Render();" to show the window and render its
contents. If you're running in the context of a WinForms application,
or something like it, then your message loop should suffice to cause
events to be processed for the render window.


HTH,
David C.





_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: ActiViz | vtkRenderWindowInteractor Start event

Matimont
Ok gotcha, is there a way to get into the VTK loop and modify stuff or once you start the interactor you're stuck with it until you close the render window?


On Tue, Apr 1, 2014 at 9:53 AM, David Cole <[hidden email]> wrote:
Do you have a "main"?

Are you calling "Application::Run(form);"?

WinForms will run a message loop for you if you call the Application Run method. In that sense, it does exactly the same thing conceptually as vtkRenderWindowInteractor::Start.

The message loop usually looks something like this, if you look at the source code for one:

   while (GetMessage(&msg, ...))
   {
     TranslateMessage(&msg);
     DispatchMessage(&msg);
   }

http://en.wikipedia.org/wiki/Message_loop_in_Microsoft_Windows


HTH,
David



-----Original Message-----
From: Matias Montroull <[hidden email]>
To: David Cole <[hidden email]>
Cc: vtkusers <[hidden email]>
Sent: Mon, Mar 31, 2014 8:56 pm
Subject: Re: [vtkusers] ActiViz | vtkRenderWindowInteractor Start event


Hi David, thanks for the response.


I'm using this into a Windows Form Application. What would be my message loop? I'm not quite sure what that means, can you explain a bit more?


Thanks!





On Sat, Mar 29, 2014 at 1:59 PM, David Cole <[hidden email]> wrote:

iren.Start(); runs a message loop, and doesn't exit until you as a user exit that window (either press the 'q' key, or close the window)

If you don't want that because you're building this into an application where you already have your own message loop, then simply don't call iren.Start();...

Instead, call "renwin.Render();" to show the window and render its contents. If you're running in the context of a WinForms application, or something like it, then your message loop should suffice to cause events to be processed for the render window.


HTH,
David C.







_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: ActiViz | vtkRenderWindowInteractor Start event

David Cole-2
You can sign up for VTK events using AddObserver before calling Start.
Then, when they occur, your observer will be called.

Whether you call Start or not depends on whether you are building an
application using some framework or not. If you are, it probably has
its own way to do message loops, and you should use that.

Start is provided as a convenience mechanism in order to try things out
with VTK, and use the same code in a simplistic cross-platform manner.
If you're building a serious application, you'll probably want to use
something more comprehensive as a UI framework (Qt, MFC, WinForms,
Metro, Apple's UIKit, ...)  But if you're just doing a one-off
visualization of something, perhaps the built-in VTK stuff is
sufficient for you.

It's your call based on what you're building. I think you probably know
that better than I do.


D

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers