Hello all,
I'm having issues getting cl-opengl working on Snow Leopard 10.6.2. I definitely had some working Lisp OpenGL stuff on my previous laptop (plain old Leopard) but the switch to SL seems to have caused a show stopper (maybe something to do with 64 bits?).
I'm using SBCL 1.0.35.2, compiled myself from git. I haven't enabled threads because they are a bit shaky on Mac, and I've specifically compiled a 32 bit version because I have some 32 bit libraries I'd like to link to.
I'm using the latest version of cl-opengl from darcs. I open up a new lisp, load :cl-glut-examples using ASDF, and then move into the package and try to run a demo (for the sake of argument #'RB-HELLO although this appears to happen with everything) and the lisp dies with this fairly cryptic error message:
* (in-package :cl-glut-examples)
#<PACKAGE "CL-GLUT-EXAMPLES"> * (rb-hello) 2010-02-15 16:33:44.197 sbcl[766:903] GLUT Warning: invalid glutGet parameter: 124 Mon Feb 15 16:33:44 mreynolds-mbp.local sbcl[766] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection Mon Feb 15 16:33:44 mreynolds-mbp.local sbcl[766] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. Mon Feb 15 16:33:44 mreynolds-mbp.local sbcl[766] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection Mon Feb 15 16:33:44 mreynolds-mbp.local sbcl[766] <Error>: kCGErrorInvalidConnection: CGSNewWindowWithOpaqueShape: Invalid connection 2010-02-15 16:33:44.233 sbcl[766:903] GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: Error (1002) creating CGSWindow
The only clue I have is that when loading the fasl files (I've deleted and recompiled all these a bunch of times so I'm pretty sure there's nothing stale in here) I get the warning you can see at the bottom of this snippet - the style warning may be nothing but the GLUT warning looks ominous.
; loading system definition from ; /Users/malc/opt/lisp/asdf-reg/cl-glut-examples.asd into #<PACKAGE "ASDF0"> ; registering #<SYSTEM CL-GLUT-EXAMPLES {12760E39}> as CL-GLUT-EXAMPLES ; loading system definition from /Users/malc/opt/lisp/asdf-reg/cl-glut.asd into ; #<PACKAGE "ASDF0"> ; registering #<SYSTEM CL-GLUT {11A9AA61}> as CL-GLUT ; loading system definition from /Users/malc/opt/lisp/asdf-reg/cl-opengl.asd ; into #<PACKAGE "ASDF0"> ; registering #<SYSTEM CL-OPENGL {11BCE579}> as CL-OPENGL ; loading system definition from /Users/malc/opt/lisp/asdf-reg/cl-glu.asd into ; #<PACKAGE "ASDF0"> ; registering #<SYSTEM CL-GLU {11D65D59}> as CL-GLU STYLE-WARNING: Keyword :CALLING-CONVENTION is obsolete, please use :CONVENTION 2010-02-15 16:33:13.944 sbcl[766:903] GLUT Warning: invalid glutGet parameter: 124 NIL
Does anyone have any ideas on how to track this down? I'm digging through the code right now but I'm by no means skilled at opengl or lisp so it's hard going..
Many thanks,
Malcolm
The only clue I have is that when loading the fasl files (I've deleted and recompiled all these a bunch of times so I'm pretty sure there's nothing stale in here) I get the warning you can see at the bottom of this snippet - the style warning may be nothing but the GLUT warning looks ominous.
** SNIP **
STYLE-WARNING: Keyword :CALLING-CONVENTION is obsolete, please use :CONVENTION 2010-02-15 16:33:13.944 sbcl[766:903] GLUT Warning: invalid glutGet parameter: 124 NIL
So far I've concluded a value of 124 for glutGet means it's being passed an item from the cenum 'get-param defined in glut/state.lisp - 124 corresponds to the keyword :init-state. If glut is not being initialised then that would certainly explain it falling over. I don't get why this would change though? I'm digging through the headers that are included with my system-provided opengl to see if I can figure out what this value should be.
Malcolm
So far I've concluded a value of 124 for glutGet means it's being passed an item from the cenum 'get-param defined in glut/state.lisp - 124 corresponds to the keyword :init-state. If glut is not being initialised then that would certainly explain it falling over. I don't get why this would change though? I'm digging through the headers that are included with my system-provided opengl to see if I can figure out what this value should be.
I think I've found the offending section which doesn't match my enum - I've put it at http://paste.lisp.org/display/94992#1. The annotation below is a section of my glut.h found in the /System/Library/Frameworks/GLUT/Headers/ folder - it matches perfectly up until the lisp one defines :init-state (which will be 124 because window-format-id is 123) but there is no constant for init-state or INIT_STATE or anything similar in glut.h. More crucially, the number 124 is included in none of the glut headers.
I think I'm pretty much done, I can see why this crashes but have no what should be done to fix it. Anyone with any advice?
Cheers
Malcolm
Try the version at http://github.com/3b/cl-opengl
It has some other issues with threads on OSX 10.6, but as far as i know, should work on unthreaded lisps. (It works on threaded lisps too, but you have to make sure it is only loaded/run from the initial thread on 10.6.)
-- b
cl-opengl-devel@common-lisp.net