Hello, im not an experienced lisper and especially new to c-bindings.
I try to handle vertex arrays in cl-opengl and have some problems with the type-specifiers. I try to explain it on the redbook example varray.lisp:
When compiling it it get the following error: -+ Errors (1) `-- SB-INT:SIMPLE-READER-PACKAGE-ERROR at 1100 (line 33, column 22) on #<SB-SYS:FD-STREAM for "file /home/jonnyb/zeug/progs/cl-opengl/examples/redbook/varray.lisp" {B797599}>: Symbol "VERTEX-POINTER" not found in the CL-OPENGL package.
When i change the package name "gl:" to "%gl:" in the line: (gl:vertex-pointer 2 :int 0 vertices) and also in the lines: (gl:color-pointer 3 :float 0 colors))) (gl:interleaved-arrays :c3f-v3f 0 intertwined) i can avoid these errors.
But then the debugger pops up with the following: The value (25 25 100 325 175 25 175 325 250 25 ...) is not of type SB-SYS:SYSTEM-AREA-POINTER. [Condition of type TYPE-ERROR]
This leads me to the following questions: Whats the difference between the "%gl:" und the "gl" package? it spent some time on it but didnt get it Does anybody know how to fix that?^^ Does this example run on somebody elses machine?
Im running it in sbcl on linux. Thank you for your help!
On Wed, Sep 10, 2008 at 6:55 AM, Sebastian Berchtold Stoned-Jonny@gmx.net wrote:
This leads me to the following questions: Whats the difference between the "%gl:" und the "gl" package? it spent some time on it but didnt get it
%gl: is for the C level bindings, which take exactly the arguments the C functions take, so you need to pass C pointers where expected instead of lisp data structures, and uses specific data types, etc. %gl is mostly autogenerated, so has everything C has.
gl: is the lisp side of the API, which uses lisp data structures, and handles (some) data type translations for you, etc. but is hand written, so less complete.
%gl is mainly for implementing the gl package, but is also available for implementing higher level abstractions when going through gl would be inefficient.
Does anybody know how to fix that?^^
implement gl:vertex-pointer, or allocate a C array using cffi, store the vertices in it, and pass that to %gl:vertex-pointer (make sure to deal with memory management, etc. properly by hand in that case, since GC can't deal with it for you)
Does this example run on somebody elses machine?
Probably not, which is probably why it isn't loaded by default :) Those APIs are sort of hard to wrap nicely, since they may need to keep pointers around, and that sort of thing, so they aren't quite done yet. I think there is an example of the current code for that in examples/misc/opengl-array.lisp.
-- b
cl-opengl-devel@common-lisp.net