Hi,<br>the test program in the bottom doesn't work as<br>expected in slime on my linux systems:<br>It should do the following:<br>when calling (run) with C-M-x it opens a window.<br>When pressing ESC in this window it will close.<br>
When calling (run) again slime is destroyed.<br><br>One work around I found is to call (reinit) before calling (run) the second time.<br><br>The problem is that *glut-initialized-p* isn't reset to nil after leaving<br>
the main loop in glut/main.lisp:<br>;; this is the fix:<br>(defun main-loop ()<br>  (without-fp-traps<br>    (%glutMainLoop))<br>  (setf *glut-initialized-p* nil) ; add this line to fix the bug<br>  init))<br><br><br><br>
<br>;; this is the test program:<br>#.(progn<br>  (require :asdf)<br>  (require :cl-opengl)<br>  (require :cl-glut)<br>  (require :cffi))<br><br>(defpackage #:mk<br>  (:use #:cl #:gl #:cffi))<br>(in-package #:mk)<br><br>(defcallback draw :void ()<br>
  (clear :color-buffer)<br>  (with-primitives :lines<br>    (vertex 1 0)<br>    (vertex 0 1))<br>  (glut:swap-buffers))<br><br>(defcallback key :void ((key :uchar) (x :int) (y :int))<br>  (declare (ignore x y))<br>  (case (code-char key)<br>
    (#\Esc (glut:leave-main-loop))))<br><br>(defun run ()<br>  (glut:init)<br>  (glut:init-display-mode :double :rgb)<br>  (glut:create-window "test")<br>  (glut:display-func (callback draw))<br>  (glut:keyboard-func (callback key))<br>
  (glut:main-loop))<br><br><br>(defun reinit ()<br>  (with-foreign-objects ((argcp :int) (argv :pointer))<br>    (setf (mem-ref argcp :int) 1)<br>    (with-foreign-string (str "test")<br>      (setf (mem-ref argv :pointer) str)<br>
      (glut::%glutInit argcp argv))))<br clear="all"><br>-- <br>Martin Kielhorn<br>Randall Division of Cell & Molecular Biophysics<br>King's College London, New Hunt's House<br>Guy's Campus, London SE1 1UL, U.K.<br>
tel: +44 (0) 207 848 6519,  fax: +44 (0) 207 848 6435<br>