window reopening bug and fix
2009-12-17 19:03:05 GMT
the test program in the bottom doesn't work as
expected in slime on my linux systems:
It should do the following:
when calling (run) with C-M-x it opens a window.
When pressing ESC in this window it will close.
When calling (run) again slime is destroyed.
One work around I found is to call (reinit) before calling (run) the second time.
The problem is that *glut-initialized-p* isn't reset to nil after leaving
the main loop in glut/main.lisp:
;; this is the fix:
(defun main-loop ()
(setf *glut-initialized-p* nil) ; add this line to fix the bug
;; this is the test program:
(:use #:cl #:gl #:cffi))
(defcallback draw :void ()
(vertex 1 0)
(vertex 0 1))
(defcallback key :void ((key :uchar) (x :int) (y :int))
(declare (ignore x y))
(case (code-char key)
(defun run ()
(glut:init-display-mode :double :rgb)
(glut:display-func (callback draw))
(glut:keyboard-func (callback key))
(defun reinit ()
(with-foreign-objects ((argcp :int) (argv :pointer))
(setf (mem-ref argcp :int) 1)
(with-foreign-string (str "test")
(setf (mem-ref argv :pointer) str)
(glut::%glutInit argcp argv))))
Randall Division of Cell & Molecular Biophysics
King's College London, New Hunt's House
Guy's Campus, London SE1 1UL, U.K.
tel: +44 (0) 207 848 6519, fax: +44 (0) 207 848 6435
_______________________________________________ cl-opengl-devel mailing list cl-opengl-devel <at> common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cl-opengl-devel