[cl-opengl-devel] Incorrect re-initialization of cl-glut on image loading

Bart Botta 00003b at gmail.com
Fri Oct 2 18:32:06 UTC 2009


On Sat, Sep 12, 2009 at 6:59 PM, Kalyanov Dmitry
<kalyanov.dmitry at gmail.com> wrote:
> If I load cl-opengl, save the Lisp image (e.g., with sb-ext:save-lisp-and-die
> on SBCL) and then load the image and call (cl-glut:init), then cl-glut::
> %glutInit doesn't get called because the variable cl-glut::*glut-initialized-
> p* is set to T (it retains its value when the image is saved). For me, this
> manifests in the following error:
>>freeglut  ERROR:  Function <glutSolidTeapot> called without first calling
> 'glutInit'.
>
> If I set cl-glut::*glut-initialized-p* to NIL before saving the image, then
> cl-glut works after restarting the saved image.

This is already fixed for non-mac platforms in my tree
(http://github.com/3b/cl-opengl) by limiting the *glut-initialized-p*
stuff to threaded mac builds. (patch is at
http://common-lisp.net/~loliveira/patches/cl-glut-init-state.diff if
anyone wants to try it with the main repo)

> (defun clear-initialized-p () (setf *glut-initialized-p* nil))
> #+sbcl (pushnew 'clear-initialized-p sb-ext:*save-hooks*)
>

I suspect this is still a problem on threaded mac lisps though, can
anyone verify it there and test the above fix (and/or a ccl version,
it looks like the function should go on ccl:*save-exit-functions*)?

--
3b




More information about the cl-opengl-devel mailing list