[vtkusers] Cocoa, Python, VTK and wx embedded window problems
Michael Jackson
mike.jackson at bluequartz.net
Wed Oct 15 19:08:36 EDT 2008
You will need to "Rez" the compiled executable although on Leopard
that is deprecated I believe. Did you write your own "main()" method?
If so you can try the following:
// Add this to your "main.cpp" file or wherever your main() method is
defined.
//
-----------------------------------------------------------------------------
// Needed to move background tasks to foreground tasks on OS X
//
-----------------------------------------------------------------------------
#ifdef __APPLE__ && defined (VTK_USE_CARBON)
#include <Processes.h>
#define APPLE_FOCUS_FIX \
ProcessSerialNumber psn = { 0, kCurrentProcess };\
OSErr err = GetCurrentProcess (&psn);\
OSStatus status = TransformProcessType ( &psn,
kProcessTransformToForegroundApplication);
#endif
int main(....)
{
APPLE_FOCUS_FIX;
....
return 0;
}
Then in your CMakeLists.txt file add the following:
# THIS MUST BE AFTER WE FIND THE VTK package..
IF (APPLE AND VTK_USE_CARBON)
# We must include this header directory in order to use some carbon
specific calls
INCLUDE_DIRECTORIES("/Developer/Headers/FlatCarbon")
ENDIF (APPLE AND VTK_USE_CARBON)
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
On Oct 15, 2008, at 6:48 PM, John Donker wrote:
> The carbon vtk view doesn't respond to mouse clicks. But the wx
> windows does. The wxWindow will cause the carbonview to react. (I
> can rotate the model, etc)
> On Oct 16, 2008, at 12:39 AM, Michael Jackson wrote:
>
>> Not sure but I think you may be hitting the "Rez" issue where a
>> carbon window will not respond to mouse clicks or anything else. Is
>> that what you are experiencing?
>>
>>
>> _________________________________________________________
>> Mike Jackson mike.jackson at bluequartz.net
>> BlueQuartz Software www.bluequartz.net
>> Principal Software Engineer Dayton, Ohio
>>
>> On Oct 15, 2008, at 6:33 PM, John Donker wrote:
>>
>>>
>>> To make it clearer i've put some screenshot online. http://wortelschijf.student.utwente.nl/vtk/
>>> The first one happens with Cocoa, the second with Carbon.
>>>
>>> On Oct 16, 2008, at 12:25 AM, John Donker wrote:
>>>
>>>> Just tried this. It's indeed stable, but has a nasty suprise. The
>>>> carbon window just stays in the corner. Sigh... The other window
>>>> continues to respond to data.
>>>>
>>>> On Oct 15, 2008, at 11:19 PM, Michael Jackson wrote:
>>>>
>>>>> The Carbon is the way to go with this. I believe wxWidgets is
>>>>> "Carbon" based and so is Python would be my guess. By compiling
>>>>> VTK with Cocoa you are mixing the 2 technologies together which
>>>>> does not work.
>>>>>
>>>>> I would stick with Carbon and figure out why it isn't "stable".
>>>>>
>>>>> _________________________________________________________
>>>>> Mike Jackson mike.jackson at bluequartz.net
>>>>> BlueQuartz Software www.bluequartz.net
>>>>> Principal Software Engineer Dayton, Ohio
>>>>>
>>>>> On Oct 15, 2008, at 5:01 PM, John Donker wrote:
>>>>>
>>>>>> I tried tried that earlier and it was completely unstable but
>>>>>> displayed correctly.
>>>>>>
>>>>>> On Oct 15, 2008, at 10:52 PM, Michael Jackson wrote:
>>>>>>
>>>>>>> I am going to take a stab in the dark here and suggest you
>>>>>>> recompile with Carbon=ON and Cocoa=OFF and see what happens.
>>>>>>>
>>>>>>>
>>>>>>> _________________________________________________________
>>>>>>> Mike Jackson mike.jackson at bluequartz.net
>>>>>>> BlueQuartz Software www.bluequartz.net
>>>>>>> Principal Software Engineer Dayton, Ohio
>>>>>>>
>>>>>>> On Oct 15, 2008, at 4:42 PM, John Donker wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I am working on a project that is using VTK with wxWidgets
>>>>>>>> and Python. And on OS X (10.5) something very strange
>>>>>>>> happens. When I try to embed the VTK window (like in the
>>>>>>>> example wxvtkWindowRender.py in wrapping/python/vtk/wx) I get
>>>>>>>> two windows of the same size. One displays the VTK openGL
>>>>>>>> output and the other responds to events. The openGL output
>>>>>>>> responds correctly, except that it's rendering in a different
>>>>>>>> window.
>>>>>>>>
>>>>>>>> The same python code works on Windows Vista without any
>>>>>>>> problems. In the terminal some messages appear that the
>>>>>>>> window can't be remapped because it's unsupported. A quick
>>>>>>>> check in the headers confirms this. But I have seen embedded
>>>>>>>> VTK windows in other apps so this unlikely. Since I have very
>>>>>>>> limited experience with OpenGL and Cocoa I don't really have
>>>>>>>> an idea where to look to solve this problem.
>>>>>>>>
>>>>>>>> I am compiling from the command-line with shared_libs,
>>>>>>>> python_wrapping and cocoa. Is this a known bug?
>>>>>>>>
>>>>>>>> Sincerely,
>>>>>>>>
>>>>>>>> John Donker
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> This is the private VTK discussion list.
>>>>>>>> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>>>
>>>>>>
>>>>>> John Donker
>>>>>> j
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> This is the private VTK discussion list.
>>>>>> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>
>>>>
>>>> John Donker
>>>> j.h.donker at home.nl (thuis)
>>>> j.h.donker at wortelschijf.nl (werk)
>>>> j.h.donker at student.utwente.nl (studie)
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> This is the private VTK discussion list.
>>>> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>> John Donker
>>> j.h.donker at home.nl (thuis)
>>> j.h.donker at wortelschijf.nl (werk)
>>> j.h.donker at student.utwente.nl (studie)
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
> John Donker
> j.h.donker at home.nl (thuis)
> j.h.donker at wortelschijf.nl (werk)
> j.h.donker at student.utwente.nl (studie)
>
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list