[vtkusers] Which one to use?! Fltk? GTK? WxWidgets..?!

Sean McInerney seanm at nmr.mgh.harvard.edu
Mon Jun 7 17:18:26 EDT 2004


AJ,

   What you seem to be proposing with your "ScreenDisplay" will not work 
unless you are using something like vtkFLTK or Charl Botha's class. 
These handle the necessary interactions between the windowing system and 
the GUI's event-driven interface. Simply deriving your class will not 
cut the mustard.

   Think of it like this:

     [windowing system] <--> [FLTK] <--> [VTK]

   Motion tracking can be accomplished either by handling the FL_MOVE 
event on the FLTK side or setting an observer for the 
vtkCommand::MouseMoveEvent on the VTK side.

-Sean

A J wrote:
> Sean, thats great! thank-you for your thorough response
> 
> I have now come across Botha's vtkFlRenderWindow and your vtkFLTK class..
> 
> As I mentioned before, my code is in C++ where I use VTK to render my 
> scene.. Its more like an animation where I do some calculations on the 
> data, then render teh scene, do some more calcs/modifcations on the 
> data, and re-render the new scene, and so forth
> 
> I have a class called ScreenDisplay which contains an instance of 
> vtkRenderWindow, which is waht calls Render() to display my scene (my 
> RenderWindow also contains multiple Renderers)
> 
> Say I didnt have these classes which bridge VTK and FLTK..
> and say I wanted to make my own callback (which would lets say display 
> only one of the Renderers in my RenderWindow).. and this callback would 
> be called upon a keypress event lets say.
> Then can I inherit my ScreenDisplay class from Fl_Widget and proceed 
> from there?
> 
> Does this make sense or have I totally lost it? Or do I need the vtkFLTK 
> class for this?
> 
> and btw has anyone done any motion tracking using FLTK?  Can I make my 
> own event whcih would be invoked upon the motion of the motion-tracker?
> 
> Thanks again,
> 
> AJ
> 
>> > So I was thinking I should use Python, but then does this mean I would
>> > have to rewrite my entire c++ code (which is quite a bit of code) to
>> > python syntax?!  OR can I wrap my c++ code to python..? But then I'm
>> > afraid that I wont be able to wrap everything because I use all kinds
>> > of data structures involving pointers, arrays, and I have several of
>> > my own classes etc..
>>
>> It might not be a bad idea to abstract your structures a bit so that 
>> they could be vtkObject subclasses. This way you can use VTK's own 
>> wrapping facilities. An interesting, but slightly more Frankenstein 
>> approach, would be to use other wrapper generators like Swig or Boost 
>> Python.
>>
>>
>> > Or I heard that there is something called GTK or FLTK or wxWidgets?
>> >
>> > So I'm really not sure which route to take right now.. Would you have
>> > any suggestions, keeping in mind that I need to maintain
>> > platform-independence, and that my code has to be fast (real-time),
>> > and that I basically need to have an event-loop to be able to detect
>> > events from a keyboard, mouse, and motion-tracker?
>>
>> I would definitely read the "GUI Toolkits for the X Window System. 
>> Ignore the "X" in the title since most of the mentioned kits are, in 
>> fact, cross platform. Find it at:
>>
>> http://nic.nac.wdyn.de/~skypher/me/writings/fm-article-toolkits/article.html 
>>
>>
>> Any of the bridges that you mention should do what you need ... you 
>> could also check out Qt. This will mostly boil down to both your own 
>> design aesthetic as well as the details of you project. Qt and 
>> wxWidgets are by far the most full featured widget toolkits but both 
>> are also massive. GTK is the middle weight contender, but is written 
>> in C with its own tacked on object and inheritance mechanism. FLTK is 
>> the leanest and meanest and will gain a great many long awaited 
>> widgets and features when its 2.0 release finally arrives. I wrote 
>> vtkFLTK for my own purposes and have included a whole bunch of 
>> examples that should provide some insight into its possibilities for 
>> you. vtkFLTK uses CMake and integrates pretty easily with VTK projects 
>> on all platforms. Building as a shared library on Win32 is currently 
>> problematic, but it represents such a small bit of code that I've 
>> always linked it in statically.
>>
>> http://vtkfltk.sourceforge.net/
>>
>> -Sean
> 
> 
> _________________________________________________________________
> Looking to buy a house? Get informed with the Home Buying Guide from MSN 
> House & Home. http://coldwellbanker.msn.com/



More information about the vtkusers mailing list