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

Bart Botta 00003b at gmail.com
Sun Nov 12 13:51:09 UTC 2006


On 11/12/06, Oliver Markovic <entrox at entrox.org> wrote:
>
> On 12.11.2006, at 09:44, Bart Botta wrote:
>
> > Second is changing the GLenums from cffi:defcenums to defconstants.
> > Advantages I can think of from doing that:
>
> This is not. The whole point of cl-opengl was having hand-written
> bindings
> that feel Lispy and not like a direct mapping to C. I do NOT want to
> write
> code like (gl:clear-color (logior gl:+color-buffer-bit+ gl:+depth-
> buffer-bit+))
> or having to think about how to construct a foreign array to pass to
> glLightfv.

I'm not arguing that the behavior of the hand written API should
change*, just the shape of the parameters. gl:clear still handles
combining the arguments, it just uses logior instead of make-bitfield.

*(well, actually, I might argue that the API should change, but if I
did, the argument would be that cl-opengl is too low level, not that
it should be closer to the C API :)

> If somebody wants to use bindings like this, Glouton[1] or kt-opengl
> [2] seem
> like a better fit.

Or my bindings if I release them, I was just hoping to have that
behavior as a subset of cl-opengl to avoid pointless forks :)

>
> Off the top of my head, I can name GL_LIGHTi, GL_AUXi, GL_TEXTUREi,
> GL_CLIPPLANEi and GL_COLOR_ATTACHMENTi_EXT and I don't know
> a single graphics card whose limits exceed those defined in the spec/
> headers,
> since a few of these are obsolete anyway thanks to programmable
> hardware.

I was thinking more of workstation level cards, 3dlabs realizm, etc.
http://www.delphi3d.net/hardware/viewreport.php?report=1503

Easy enough to just add more enums to cover the extra if you stay with
cffi enums, so it isn't too much of a problem.

> >  *compatibility with other bindings (glx and cl-sdl both use +foo+
> > style for enums if I remember correctly)
>
> I neither care about GLX nor CL-SDL. If neither CLX, nor any other
> non-C library
> use +foo+, why should we? Personally, I think it looks way too ugly.

Sorry, I meant CLX, not GLX :
http://common-lisp.net/~crhodes/clx/gl.lisp
and CL-SDL is a set of lisp bindings for SDL and OpenGL.

The 2 libraries you linked both used GL_FOO style
constants/defparameters though, so not sure how much it matters.

> But even then, the performance impact of doing so at runtime is
> neglible.

Might be, I'll have to see if I can think of any concrete tests and try it...



More information about the cl-opengl-devel mailing list