OK, in a drug fuelled moment of madness (diet-coke and a Snickers, too much sugar I guess) I decided I want to write an OpenGL interface to SLIME and I have been fiddling with it on and off for a few months now, don't ask, it's not going 'that' well. :-)
I am using cl-opengl and Apple X11 X-server and it's working as expected, I had to make a small change to the library.lisp file to load the OpenGLUT library that I built:
(define-foreign-library glut ;;-- (sjc-03-jul-06) -- added this line to ensure my locally built ;;-- OpenGLUT library is loaded as the "glut" library! ((: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")))
I had to do it this way because at the time I just couldn't get the GLUT.framework to load after many hours of head scratching. Anyhow, I have just been trying to get the Cocoa GLUT framework to load again (I hate being beaten by dumb machines) and I am stuck!
In an attempt to get around the blasted message:
<NSInternalInconsistencyException> Error (1002) creating CGSWindow
which appears every time it tried to load the framework, I ended up with the following code:
;; For GLUT.framework to operate we also need to load the Cocoa.framework ;; and the OpenGL frameworks ?!?!?! ;; (define-foreign-library cocoa ((:and :darwin :x86) (:framework "Cocoa")))
(define-foreign-library opengl ((:and :darwin :x86) (:framework "OpenGL")))
(define-foreign-library glut ;((: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")))
(use-foreign-library cocoa) (use-foreign-library opengl) (use-foreign-library glut)
(cffi:defcfun ("NSApplicationLoad" nsapplicationload) :int) (nsapplicationload)
...which kind of worked in that the NSInternalInconsistencyException has now gone away but when I try to run the MESADEMOS:GEARS program, the system hangs and when I hit CTRL-C I get:
* (mesademos:gears) ^C debugger invoked on a SIMPLE-CONDITION in thread #<THREAD "initial thread" {122A9301}>: interrupted at #X90009857
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. 1: [ABORT ] Exit debugger, returning to top level.
(SB-UNIX::SIGINT-HANDLER #<unavailable argument> #<unavailable argument> #.(SB-SYS:INT-SAP #X02206D5C)) 0]
...my only thoughts are that NSApplicationLoad is an Objective-C function and that there may be a problem using (defcfun ...) to call it.... does anybody have any idea why I am not getting my OpenGL windows ?
Thanks, Sean Charles.