[cello-devel] Re: Cello

Thomas F. Burdick tfb at OCF.Berkeley.EDU
Wed Mar 10 18:04:16 UTC 2004


jan writes:
 > "Thomas F. Burdick" <tfb at OCF.Berkeley.EDU> writes:
 > 
 > > Kenny Tilton writes:
 > >> 
 > >> jan wrote:
 > >> 
 > >>>Hi Kenny,
 > >>>
 > >>>At the moment the CMUCL port isn't going well, the only `progress'
 > >>>I've been able to make since I last mailed you was to find that the
 > >>>same problem occurs on SBCL.
 > >>
 > >> Sounds specific. What is the problem?
 > > 
 > > Yikes, I'm curious too.
 > 
 > Here is the minimal program I'm trying to get working.
 > I'm getting a segfault in ffi land.

I checked this on Darwin (Linux box is in storage), and I just
confirmed over here that your test works on SBCL, and CMUCL (minus
callbacks).  So I'm guessing it's one of a few things:

  (a) a bug in freeglut 2.0 (I'm using 2.2.0)
  (b) a bug in CMUCL's callbacks
or
  (c) Linux-specific

What I'd do is, in this order: try it with freeglut 2.2; try getting
rid of the callback; finally, run cmucl under gdb, and try to figure
out what's happening in ffi land.

I set myself a 10am cutoff for playing with Cello this morning (gotta
get to work), so I don't have time to check this on Solaris, which is
the closest thing to Linux I have available.

Here's the test files I used:

===File ~/tmp/sbcl-test.lisp================================
(sb-alien:load-1-foreign "/usr/X11R6/lib/libGL.dylib")
(sb-alien:load-1-foreign "/usr/local/lib/libfreeglut.dylib")

(sb-alien:define-alien-routine ("glFlush" gl-flush)
    sb-alien:void)

(sb-alien:define-alien-routine ("glClear" gl-clear)
    sb-alien:void
  (mask integer :in))

(sb-alien:define-alien-routine ("glutInitDisplayMode" glut-init-display-mode)
    sb-alien:void
  (mode sb-alien:unsigned-int :in))

(sb-alien:define-alien-routine ("glutCreateWindow" glut-create-window)
    integer
  (title sb-alien:c-string :in))

(sb-alien:define-alien-routine ("glutDisplayFunc" glut-display-func)
    sb-alien:void
  (callback (* t) :in))

(sb-alien:define-alien-routine ("glutMainLoop" glut-main-loop)
    sb-alien:void)

(defconstant GL_COLOR_BUFFER_BIT #x00004000)
(defconstant GLUT_SINGLE #x0000)
(defconstant GLUT_RGB #x0000)

(sb-alien:define-callback simple-render (sb-alien:void)
  (gl-clear GL_COLOR_BUFFER_BIT) 
  (gl-flush))

(defun simple-window ()
  (glut-init-display-mode (logior GLUT_SINGLE GLUT_RGB))
  (glut-create-window "Title.")
  (glut-display-func (sb-alien:callback simple-render))
  (glut-main-loop))

(simple-window)
============================================================


===File ~/tmp/cmucl-test.lisp===============================
(sys::load-object-file "/usr/X11R6/lib/libGL.dylib")
(sys::load-object-file "/usr/local/lib/libfreeglut.dylib")


(alien:def-alien-routine ("glFlush" gl-flush)
    c-call:void)

(alien:def-alien-routine ("glClear" gl-clear)
    c-call:void
  (mask integer :in))

(alien:def-alien-routine ("glutInitDisplayMode" glut-init-display-mode)
    c-call:void
  (mode c-call:unsigned-int :in))

(alien:def-alien-routine ("glutCreateWindow" glut-create-window)
    integer
  (title c-call:c-string :in))

(alien:def-alien-routine ("glutDisplayFunc" glut-display-func)
    c-call:void
  (callback (* t) :in))

(alien:def-alien-routine ("glutMainLoop" glut-main-loop)
    c-call:void)

(defconstant GL_COLOR_BUFFER_BIT #x00004000)
(defconstant GLUT_SINGLE #x0000)
(defconstant GLUT_RGB #x0000)

#+(or)
(alien:def-callback simple-render (c-call:void)
  (gl-clear GL_COLOR_BUFFER_BIT) 
  (gl-flush))

(defun simple-window ()
  (glut-init-display-mode (logior GLUT_SINGLE GLUT_RGB))
  (glut-create-window "Title.")
  ; (glut-display-func (c-call:callback simple-render))
  (glut-main-loop))

(simple-window)
============================================================




More information about the cello-devel mailing list