hello,
I am making some tests with cl-opengl to make standalone executables with "sb-ext:save-lisp-and-die"... I am usign SBCL 1.0.29 in Mac OSX and have downloaded the "thomas" version available from (http://www.esden.net/content/lisp/cl-mac-native-opengl-thomas-0.1.tar.bz2)...
(is this one the recommended version for Mac OSX?)
My first attempt was to create an external from the redbook cube.lisp example...
so, after evaluating through slime "(require 'asdf)" and all the functions of cube.lisp, I have evalueted this code:
(sb-ext:save-lisp-and-die "rb-cube-binario" :executable t :save-runtime-options t :toplevel 'rb-cube)
But when I try to run the executable binary "./rb-cube-binario" from terminal I get this error:
/Users/ze/sbcl-lib/cl-opengl-thomas-0.1/examples/redbook/rb-cube-binario ; exit; 2009-06-24 01:14:32.606 rb-cube-binario[67793:10b] GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: Error (1002) creating CGSWindow
It seems to be related to "glutInit(&argc, argv);", in a C syntax, but I have no idead on how to add this in cl-opengl style... When running "(rb-cube)" from slime I get no errors...
Thanks for any tips. josé
On Wed, Jun 24, 2009 at 5:23 AM, padovanijosepadovani@yahoo.com.br wrote:
I am usign SBCL 1.0.29 in Mac OSX and have downloaded the "thomas" version available from (http://www.esden.net/content/lisp/cl-mac-native-opengl-thomas-0.1.tar.bz2)...
(is this one the recommended version for Mac OSX?)
I can't recommend that version because I don't know what's in it. I suggest you download that latest version from the darcs repository and help test this patch: http://thread.gmane.org/gmane.lisp.cl-opengl.devel/308, a work-in-progress by Jean-Philippe apparently based on that same code.
(sb-ext:save-lisp-and-die "rb-cube-binario" :executable t :save-runtime-options t :toplevel 'rb-cube)
[...]
It seems to be related to "glutInit(&argc, argv);", in a C syntax, but I have no idead on how to add this in cl-opengl style...
GLUT:INIT is the respective Lisp function.
I cleaned up jpb's patch and added proper window close functionality. Some notes:
* It seems that freeglut takes care of destroying windows on close automatically. There is destroy-current-window function in cl-glut but it is not getting called at all by anything in cl-glut.
GLUT framework on darwin does not do this, so one has to destroy windows manually. Also, it seems that freeglut takes care of managing the window close behavior as long as one sets it with set-action-on-window-close which calls glutSetOption accordingly. glutSetOption does not exist in darwin glut so one has to manage the window behavior manually from within the close callback.
I added wm-close generic methods as glutCloseFunc does not exist in darwin (glutWMCloseFunc should be used instead) which try to do the right thing but i'm sure the behavior can be further improved. Right now, one sets the wanted window-close behavior as before with set-action-on-window-close which, on darwin, instead of calling glutSetOption sets a global variable which is used inside the wm-close methods to decide what to do (all relevant code is in interface.lisp). This works fine with all glut examples here. One can run (cl-glut-examples:run-examples), close windows without terminating glut and only return from the glut event loop when all windows have been closed.
Again this works fine here, but i do get some warnings from GLUT when windows are closed: 2009-06-24 18:24:52.884 sbcl[47808:10b] GLUT Warning: glutSetWindow attempted on bogus window. Someone might want to take a look at that as well as game-mode which i did not do anything about.
Patch is tested with current cl-opengl on 10.4 and 10.5 on latest sbcl.
cl-opengl-devel@common-lisp.net