From: Jeff M.
Subject: LW 5 FLI issues on OS X
Date: 
Message-ID: <1180368550.349949.243670@h2g2000hsg.googlegroups.com>
I'm trying to get some simple OpenGL bindings working on LW 5 in OS X.
I know there are examples that come with LW, and I am looking at them,
but I'm trying to do some things on my own to learn.

Even with the most trivial examples, I'm getting LW to crash over and
over again. I'm hoping someone here can point out the error of my
ways?

(fli:register-module "libgl.dylib"
    :real-name #| path to libgl.dylib here |#
    :connection-style :immediate)

(fli:define-foreign-function (gl-end "glEnd" :source)
    ()
  :module "libgl.dylib"
  :result-type :void
  :language :ansi-c)

(gl-end)

Even though there is no context, etc, the above shouldn't crash, but
it does. On Win32 the above works just fine (replacing "libgl.dylib"
with "opengl32.dll" of course).

Just for kicks, I decided to open up the examples and try to get those
running. The simplest one looked like the icosahedron test. That
didn't crash, but there was no opengl rendering going on, just a
window with controls.

Anyone have any ideas? Thanks in advance!

Jeff M.

From: Rainer Joswig
Subject: Re: LW 5 FLI issues on OS X
Date: 
Message-ID: <joswig-5281D9.18221028052007@news-europe.giganews.com>
In article <························@h2g2000hsg.googlegroups.com>,
 "Jeff M." <·······@gmail.com> wrote:

> I'm trying to get some simple OpenGL bindings working on LW 5 in OS X.
> I know there are examples that come with LW, and I am looking at them,
> but I'm trying to do some things on my own to learn.
> 
> Even with the most trivial examples, I'm getting LW to crash over and
> over again. I'm hoping someone here can point out the error of my
> ways?
> 
> (fli:register-module "libgl.dylib"
>     :real-name #| path to libgl.dylib here |#
>     :connection-style :immediate)
> 
> (fli:define-foreign-function (gl-end "glEnd" :source)
>     ()
>   :module "libgl.dylib"
>   :result-type :void
>   :language :ansi-c)
> 
> (gl-end)
> 
> Even though there is no context, etc, the above shouldn't crash, but
> it does. On Win32 the above works just fine (replacing "libgl.dylib"
> with "opengl32.dll" of course).
> 
> Just for kicks, I decided to open up the examples and try to get those
> running. The simplest one looked like the icosahedron test. That
> didn't crash, but there was no opengl rendering going on, just a
> window with controls.
> 
> Anyone have any ideas? Thanks in advance!
> 
> Jeff M.

Btw., do you know that there is a mailing list for LispWorks
users?

http://www.lispworks.com/support/lisp-hug.html

Here is an archive of mails:
http://dir.gmane.org/gmane.lisp.lispworks.general

-- 
http://lispm.dyndns.org
From: Luke Crook
Subject: Re: LW 5 FLI issues on OS X
Date: 
Message-ID: <1180572047.647953.65180@i38g2000prf.googlegroups.com>
Jeff M. wrote:
> I'm trying to get some simple OpenGL bindings working on LW 5 in OS X.
> I know there are examples that come with LW, and I am looking at them,
> but I'm trying to do some things on my own to learn.
>
> Even with the most trivial examples, I'm getting LW to crash over and
> over again. I'm hoping someone here can point out the error of my
> ways?
> Anyone have any ideas? Thanks in advance!

You could use cl-opengl which does work in OS X. Or if you want to
roll your own, here is equivalent code using CFFI.

(define-foreign-library opengl
  (:darwin (:framework "OpenGL"))))

(use-foreign-library opengl)

(defcfun ("glEndList" glEndList) :void)
From: Jeff M.
Subject: Re: LW 5 FLI issues on OS X
Date: 
Message-ID: <1180620544.640505.65790@q75g2000hsh.googlegroups.com>
On May 30, 7:40 pm, Luke Crook <····@balooga.com> wrote:
> Jeff M. wrote:
> > I'm trying to get some simple OpenGL bindings working on LW 5 in OS X.
> > I know there are examples that come with LW, and I am looking at them,
> > but I'm trying to do some things on my own to learn.
>
> > Even with the most trivial examples, I'm getting LW to crash over and
> > over again. I'm hoping someone here can point out the error of my
> > ways?
> > Anyone have any ideas? Thanks in advance!
>
> You could use cl-opengl which does work in OS X. Or if you want to
> roll your own, here is equivalent code using CFFI.
>
> (define-foreign-library opengl
>   (:darwin (:framework "OpenGL"))))
>
> (use-foreign-library opengl)
>
> (defcfun ("glEndList" glEndList) :void)

Thanks, Luke.

I searched a good hunk of gmane and couldn't find any comments or
information on this particular problem (which leads me to believe I'm
doing something wrong). I was hoping to just use the LW FLI
implementation instead of something like CFFI, but I suppose I could
use CFFI just for the macro expansions to see what they are doing -
assuming it works.

Thanks again.

Jeff M.
From: Stefan Nobis
Subject: Re: LW 5 FLI issues on OS X
Date: 
Message-ID: <m2fy5clu5u.fsf@snobis.de>
Luke Crook <····@balooga.com> writes:

> You could use cl-opengl which does work in OS X.

Ah, as you mention it: I'm new to Mac OS X and I just tried to play a
little with cl-opengl and sbcl on osx. But I get these errors (when
loading cl-opengl via asdf; one for every opengl function):

,----
| ; file: /Users/stefan/lisp/lib/cl-opengl/gl/funcs.lisp
| ; in: DEFGLFUN ("glAccum" %GLACCUM)
| ;     (CL-OPENGL::DEFGLFUN ("glAccum" CL-OPENGL::%GLACCUM) :VOID
| ;                        (CL-OPENGL::OP CL-OPENGL:ENUM) (CL-OPENGL::VALUE FLOAT))
| ; 
| ; caught ERROR:
| ;   (during macroexpansion of (DEFGLFUN ("glAccum" %GLACCUM) ...))
| ;   The function CFFI::LISP-FUNCTION-NAME is undefined.
`----

Any idea what's wrong? I use for both libraries (cl-opengl and cffi)
the darcs version.

-- 
Stefan.
From: Barry Fishman
Subject: Re: LW 5 FLI issues on OS X
Date: 
Message-ID: <m33b1cejra.fsf@barry_fishman.acm.org>
--=-=-=

Stefan Nobis <······@gmx.de> writes:

> Luke Crook <····@balooga.com> writes:
>
>> You could use cl-opengl which does work in OS X.
>
> Ah, as you mention it: I'm new to Mac OS X and I just tried to play a
> little with cl-opengl and sbcl on osx. But I get these errors (when
> loading cl-opengl via asdf; one for every opengl function):
>
> ,----
> | ; file: /Users/stefan/lisp/lib/cl-opengl/gl/funcs.lisp
> | ; in: DEFGLFUN ("glAccum" %GLACCUM)
> | ;     (CL-OPENGL::DEFGLFUN ("glAccum" CL-OPENGL::%GLACCUM) :VOID
> | ;                        (CL-OPENGL::OP CL-OPENGL:ENUM) (CL-OPENGL::VALUE FLOAT))
> | ; 
> | ; caught ERROR:
> | ;   (during macroexpansion of (DEFGLFUN ("glAccum" %GLACCUM) ...))
> | ;   The function CFFI::LISP-FUNCTION-NAME is undefined.
> `----
>
> Any idea what's wrong? I use for both libraries (cl-opengl and cffi)
> the darcs version.

I had a similar problem.  CFFI::LISP-FUNCTION-NAME seems to have been
removed from CFFI, and replaced (?) with LISP-NAME.  I did the attached
patch.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=cl-opengl.diff
Content-Description: Change lisp-function-name to lisp-name

diff -rN -u old-cl-opengl/gl/funcs.lisp new-cl-opengl/gl/funcs.lisp
--- old-cl-opengl/gl/funcs.lisp	2006-11-13 14:26:31.000000000 -0500
+++ new-cl-opengl/gl/funcs.lisp	2007-04-11 12:09:28.000000000 -0400
@@ -31,10 +31,10 @@
 
 ;;; Helper macro to define a GL API function and declare it inline.
 ;;;
-;;; FIXME: LISP-FUNCTION-NAME should probably be exported from CFFI
+;;; FIXME: LISP-NAME should probably be exported from CFFI
 ;;; for helper macros like this one.
 (defmacro defglfun (name result-type &body body)
-  (let ((lisp-name (cffi::lisp-function-name name)))
+  (let ((lisp-name (cffi::lisp-name name)))
     `(progn
        (declaim (inline ,lisp-name))
        (defcfun ,name ,result-type ,@body))))

--=-=-=


Note "LISP-NAME" isn't exported either.  I also had a problem in
"glu/library.lisp" with the contents of "(define-foreign-library glu",
but I probably broke Mac OS X, when fixing it for Linux.

-- 
Barry

--=-=-=--