[cl-opengl-devel] Helping out from OSX

sathya gnanasekaran thekingoftruth at gmail.com
Sat Mar 17 09:46:00 UTC 2007


It has something to do with the functions in interface.lisp, I believe. (I
can't remember for sure, but I THINK, if you call glut:init twice using
apple's cocoa glut it gives you that NSApplicationInit() error.)

All I had to do (I think, it's been a while) was to use that (:darwin
(:framework "GLUT")) line in library.lisp.

My sample code is attached, Sean, although it won't run as it is, unless you
install cl-arcball. Remove all of the cl-arcball code and it should run for
you. (Or, since I'm also attaching my cl-arcball asdf-install library, you
can just asdf-install cl-arcball 0.1).

Note all of the cffi foreign function and foreign type conversion and
callback stuff. It's not hard once you read through the code, in my opinion.

On 3/17/07, Sean Charles <sean.charles at objitsu.com> wrote:
>
> I am sure the thing that stopped me was not being able to call
> NSApplicationInit()... I did manage to get something going but it kept
> dropping out with an error, which, on looking it up said I had to call
> NSApplicationInit() but my CFFI experience is limited and I couldn't work
> out how to do it.
> I looked at Verrazano as well but in the end time pressures made me go for
> X11. It just worked, I had to make a small change to get it to work on an
> intel mac though if I remember I just modded the library.lisp file a bit.
> My finally chaotic glut def looks like:
>
> (define-foreign-library glut
>   ;;-- (sjc-03-jul-06) -- added this line to ensure my locally built
>   ;;-- OpenGLUT library is loaded as the "glut" library!
>   ;;
>   ;; (1) /usr/local/lib/libopenglut.dylib  => my build from OpenGLUT
> source package.
>   ;; (2) /sw/lib/libglut.dylib => FINK installation of 3.7-1025
>   ;;
>   ;; Q. Which one is 'better' to use, if any ?!
>   ;;    (1) because (2) doesn't have glutLeaveMainLoop etc !!!
>   ;;
>   ;((:and :darwin :x86) "/sw/lib/libglut.dylib")
>   ((:and :darwin :x86) "/usr/local/lib/libopenglut.dylib")
>   ;((:and :darwin :x86) (:framework "GLUT"))
>   ;(:darwin (:or "libglut.dylib" "libglut.3.dylib" #-(and)(:framework
> "GLUT")))
>   (:windows "freeglut.dll") ; XXX: is this right?
>   (:unix (:or "libglut.so" "libglut.so.3")))
>
> which, removing the chaff leaves this, I added the :x86 to make it intel
> friendly!
>
> (define-foreign-library glut
>   ((:and :darwin :x86) "/usr/local/lib/libopenglut.dylib")
>   (:windows "freeglut.dll") ; XXX: is this right?
>   (:unix (:or "libglut.so" "libglut.so.3")))
>
>
>
> On 17 Mar 2007, at 00:11, sathya gnanasekaran wrote:
>
> Yeah, it annoys me a lot. I'll check if anyone has any prior work done in
> that direction first, but if not, I'll look into it. The problem is I have
> little cocoa/carbon experience. Time to learn I guess.
>
> On 3/16/07, Luís Oliveira <luismbo at gmail.com> wrote:
> >
> > On 16/03/07, sathya gnanasekaran <thekingoftruth at gmail.com> wrote:
> > > I use cl-opengl on OSX to play with opengl in lisp. I use it by
> > > changing the library from freeglut to apple's cocoa-based glut
> > > framework. (Although I'm sure I could use apple's X11 + freeglut, X
> > > has given be trouble.)
> >
> > That GLUT will call exit() (and kill your Lisp) very often, doesn't
> > that annoy you? Hey, you could port freeglut to Cocoa (or is it
> > Carbon?), that'd be nice. :-)
> >
> > --
> > Luís Oliveira
> > http://student.dei.uc.pt/~lmoliv/ <http://student.dei.uc.pt/%7Elmoliv/>
> >
>
> _______________________________________________
> cl-opengl-devel mailing list
> cl-opengl-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cl-opengl-devel
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-opengl-devel/attachments/20070317/89b50304/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lisp-opengl.lisp
Type: application/octet-stream
Size: 2986 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-opengl-devel/attachments/20070317/89b50304/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cl-arcball_0.1.tar.gz
Type: application/x-gzip
Size: 11545 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-opengl-devel/attachments/20070317/89b50304/attachment.bin>


More information about the cl-opengl-devel mailing list