[cl-opengl-devel] generating function bindings, extension loading

Bart Botta 00003b at gmail.com
Sun Nov 12 08:44:52 UTC 2006


I've been working on generating bindings from the .spec files on
opengl.org, and it seems to be to the point where it could be turned
into a patch...

Before that though, I wanted to get some feedback about changing the
naming for the bindings:

First suggestion is moving the function bindings to a separate
package, and giving them lisp style names, so people like me who want
to use them directly have supported access to them.

Second is changing the GLenums from cffi:defcenums to defconstants.
Advantages I can think of from doing that:
  *Easier for users to add enums from a new extension without
modifying library code (unless cffi allows adding to an enum after it
is defined, not sure about that)

  *Easier to add offsets to them, for example a loop to disable all
lights could use (+ index gl:+light0+) instead of having to convert
from enum and back, or store a list of the light enums or whatever.

  *being able to add offsets also solves the problem of some values
(light in particular) potentially having more valid values than are
enums. (The .spec files name 8 lights, but leaves room for 4096, I'm
pretty sure there has been hardware supporting at least 32.)

  *compatibility with other bindings (glx and cl-sdl both use +foo+
style for enums if I remember correctly)

  *possibly speed. If cffi can remap values at compile time it
probably isn't too bad, but it probably wouldn't be too hard to find
code with a lot of enums specified at runtime.

(Alternately, is it possible to tell cffi to allow using either the
constants or the keywords?)


Also, a small patch: someone in #lisp was having problems with OpenMCL
objecting to compute-applicable-methods being called with extra
arguments in glut/interface.lisp, which was fixed by the following
patch to define-glut-event:

diff -rN old-pct/glut/interface.lisp new-pct/glut/interface.lisp
130c130
<                          :func ',event-func :arg-count ,(length args))
---
>                          :func ',event-func :arg-count ,(length arg-names))



More information about the cl-opengl-devel mailing list