Hi, folks. I’m porting a commercial Python/C++ application from
Windows to Mac, and trying to preserve 95% of the code base as completely cross
platform. It’s an OpenGL application that constructs its own GUI in the
window, so I don’t need ANY UI widgets. At all. I should warn you that this is my first experience coding
for the Mac, though I have written code for a variety of platforms. The way it works on the PC side is that Python code calls a
createWindow function in our app to manufacture the main window. This creates
and initializes an OpenGL context. It then calls a mainloop() function that
only returns when the app closes. The mainloop() knows about the GL context and
can manipulate it. Our first pass at the port attempts to use Carbon to do the
same thing. Everything has compiled and the app basically runs, but there are
definitely issues, and in many ways the world would be made much nicer if we
did something more appropriately “native” to the Mac platform. This is what I’ve come up with so far: Build a Python and NIB-based application similar to the
OpenGLDemo application found in PyOpenGL. Basically, we construct a NIB and a
driver module that doesn’t do a whole lot more than instantiate an
NSOpenGLView. The startup Python code for the app creates that window and
has a bunch of handlers in place for all the user and window events. The aglContext
object is retrieved from the NSOpenGLView and passed in to the C++ code for use
in rendering. The handlers dispatch their various events as needed within
the application structure. In most cases, they will be able to stay in python,
but in some cases (resize, for example) the information will have to get passed
in to the C++ code. A few questions: a) Is this a reasonable
architecture? Please understand that rewriting our entire application to be
more “Mac-ish” is not an option in this release. b) The intent
is to create a single application that will run on as wide a range of OS X machines
as possible. We’ve been developing on 10.3 and messing about with 10.4,
and that’s cool, but first blush seems to indicate that supporting 10.2
is much more problematic than 10.3. Am I correct about that? How much work is
it to support both? Is it worth the trouble? I don’t care about developing
on 10.2, only about delivering on it. c) PyOpenGL
seems to be constructing a menu that says things like “CocoaGL”. I
don’t know how to change it, and it’s not obvious from the combination
of the demo app and the documentation I’ve managed to absorb to date. I’m sure I can come up with a ton of questions, but this
seems to be one of those situations where you kind of need to know it all to
know any of it. I don’t yet know which questions are stupid ones, so
please bear with me. Thanks, |
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig