From kielhorn.martin at googlemail.com Thu Dec 17 19:03:05 2009 From: kielhorn.martin at googlemail.com (Martin Kielhorn) Date: Thu, 17 Dec 2009 19:03:05 +0000 Subject: [cl-opengl-devel] window reopening bug and fix Message-ID: <1ae41e820912171103y6729271dm64fc77b4c31f6430@mail.gmail.com> Hi, 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 () (without-fp-traps (%glutMainLoop)) (setf *glut-initialized-p* nil) ; add this line to fix the bug init)) ;; this is the test program: #.(progn (require :asdf) (require :cl-opengl) (require :cl-glut) (require :cffi)) (defpackage #:mk (:use #:cl #:gl #:cffi)) (in-package #:mk) (defcallback draw :void () (clear :color-buffer) (with-primitives :lines (vertex 1 0) (vertex 0 1)) (glut:swap-buffers)) (defcallback key :void ((key :uchar) (x :int) (y :int)) (declare (ignore x y)) (case (code-char key) (#\Esc (glut:leave-main-loop)))) (defun run () (glut:init) (glut:init-display-mode :double :rgb) (glut:create-window "test") (glut:display-func (callback draw)) (glut:keyboard-func (callback key)) (glut:main-loop)) (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)))) -- Martin Kielhorn 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From luismbo at gmail.com Sun Dec 20 00:32:42 2009 From: luismbo at gmail.com (=?ISO-8859-1?Q?Lu=EDs_Oliveira?=) Date: Sun, 20 Dec 2009 00:32:42 +0000 Subject: [cl-opengl-devel] window reopening bug and fix In-Reply-To: <1ae41e820912171103y6729271dm64fc77b4c31f6430@mail.gmail.com> References: <1ae41e820912171103y6729271dm64fc77b4c31f6430@mail.gmail.com> Message-ID: <391f79580912191632q233bbfd9j61fe9ccf5cf40255@mail.gmail.com> Hello Martin, On Thu, Dec 17, 2009 at 7:03 PM, Martin Kielhorn wrote: > 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. I found a patch laying around with a fix for this; I've pushed it to the repository. Let me know if it fixes your problem. -- Lu?s Oliveira http://r42.eu/~luis/