[Openmcl-devel] The Miracle of opengl-ffi.lisp Astounds Newby!
Hamilton Link
hamlink at comcast.net
Wed Nov 10 20:08:13 PST 2004
On Nov 10, 2004, at 4:36 PM, Kenneth Tilton wrote:
> Platform: Mikel Evins's Lisp in a box, aka OpenMCL and Slime and Emacs
>
> OK, the good news is that a significant amount of Cello has been
> ported to OS X/OpenMCL. If I could only manage to build ImageMagick
> and crucially the Wand API therein I think we could pop the cork.
>
> But that is not why I am here. We observe that when the demo in
> opengl-ffi.lisp runs, the menubar changes to "Simple OpenGL Example"
> or some such and some standard menu iems appear.
>
> <ogl.lisp>
>
> That example was great because it got us going with calling Apple's
> Glut just to get a window open. ie, We borrowed liberally from that
> code and have been borrowing more to try to solve this problem:
>
> The Cello window appears but the menu bar stays as Emacs's.
This is what I'd expect.
Emacs is its own program, and is forking off the lisp program and
talking to it by attaching to its stdio. When the cocoa environment
gets fired up, the lisp program is turning from a command-line app into
a more aqua-ish app, and makes its own windows in that context. You
should, for example, see a lisp doc item appear when the cocoa stuff is
loaded, and if you click on the opengl window you should end up
changing the window focus and thus the foremost app, and the openmcl
menubar should appear. Switching back to emacs will get its menubar
back. This is essentially identical to running openmcl/cocoa from the
terminal, and switching between the terminal program's window (which
holds a command line view of the lisp program) and the aqua view of
lisp once cocoa is started.
Mind you this artifact of the transition from unix app to aqua app
might be worth noting somewhere in the docs... I think we have or were
going to have an FAQ? Dan?
And if you'd like a more extensive opengl example, where glut is used
less (um, not at all actually iirc), look in the ccl/examples/rubix
directory. Yes, looking now I made it use a NSOpenGLView and handle
mouse events etc. through that view, and dispensed with glut entirely.
It's more cocoa-friendly. When I first did the serpinski's gasket
example (in opengl-ffi.lisp) it was using glut through the normal FFI,
and I don't know if it ever got ported to the cocoa APIs, although I
seem to recall GB taking a crack at it.
But anyway yeah, look at the rubix example. It's way better. And feel
free to ask questions, to the list preferably, about the cocoa bridge
or NSOpenGLView. Mind you that I may send you to the Cocoa docs for
some things.
And if you want to make code look like anything, emulate the rubix
example! It's much newer and it built on lessons learned from
opengl-ffi.
h
>
> Another contrast between opengl-ffi.lisp and Cello is that the former
> gets key events and the latter does not. (This sounds like the same
> thing to me, but anyway....)
>
> Frank is slowly making the Cello demo look more and more like
> OpenGL-ffi's trying to make it work, while I am slowly replacing code
> in OpenGL-ffi trying to make it fail. That should pay off eventually,
> but I thought I would drop in here to see if anyone knew by what magic
> opengl-ffi was getting the menu bar and key events.
>
> btw, my guess is there some mystery about OS X we are missing, not
> OpenMCL, but I thought I would cover all the bases just in case my
> guessqork is off.
>
> kenny
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
More information about the Openmcl-devel
mailing list