[cl-opengl-devel] OSX native glut patch

xristos xristos at suspicious.org
Wed Jun 24 17:44:56 UTC 2009


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: darwin.patch
Type: application/octet-stream
Size: 11006 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-opengl-devel/attachments/20090624/d220fb61/attachment.obj>


More information about the cl-opengl-devel mailing list