[cl-opengl-devel] extension loading + wrapper generation

Bart Botta 00003b at gmail.com
Mon Nov 13 10:52:44 UTC 2006


OK, first draft of the wrapper generation/extension loading code is available
at http://www.3bb.cc/tmp/cl-opengl-3b.tar.bz2
Let me know if you have any problems/suggestions...

main changes:
*generates gl/funcs.lisp from gl.spec

*uses gl extension support for extensions and functions from versions >= 1.2
  - works on win32 (tested with sbcl 0.9.18)
  - can save cores (tested on sbcl 0.9.18 amd64 linux and x86 win32, and cmucl
    19dpre2 x86 linux)

*rearranged low level bits into a separate package
  - cl-opengl-bindings, nickname %gl
  - basic types, constants, function wrappers

*binding names are lisp style
  - %gl:vertex-3f instead of %glVertex3f

*Makefile downloads current .spec files from opengl.org if needed
(with wget), then builds gl/constants.lisp, gl/bindings-package.lisp
and gl/funcs.lisp

*rename calls to %gl* as applicable in gl/*lisp

*glut/init.lisp: need to tell extension loader how to get extension
pointers from glut
  (possibly should be some somewhere other than glut:init though?)

*misc patches (see end of message)


I noticed some of the cl-opengl code uses things like (:pointer
gl:double) instead of :pointer for defcfun parameter types, is this
something the generated bindings should do also? (and if so, is
(:pointer (:pointer foo)) correct syntax for foo**?)
Wrapper generator handles either option, just wasn't sure what
benefits it had, and if it was worth dropping cffi 0.9.1 support for.



Misc patches mentioned above, not part of the extension/wrapper stuff,
but needed for testing on my systems:

  -nvidia 96.29 amd64 linux drivers are returning
FRAMEBUFFER_UNSUPPORTED_EXT from the completeness check in
misc/render-to-texture.lisp if the texture doesn't have mipmaps

  - windows GLU doesn't seem to have gluCheckExtension or gluUnProject4


diff -rN -u old-cl-opengl/examples/misc/render-to-texture.lisp
new-cl-opengl/examples/misc/render-to-texture.lisp
--- old-cl-opengl/examples/misc/render-to-texture.lisp  2006-11-13
04:30:03.000000000 -0600
+++ new-cl-opengl/examples/misc/render-to-texture.lisp  2006-11-13
04:30:03.000000000 -0600
@@ -28,6 +28,8 @@
     (gl:tex-parameter :texture-2d :texture-min-filter :linear-mipmap-linear)
     (gl:tex-parameter :texture-2d :texture-mag-filter :linear)
     (gl:tex-image-2d :texture-2d 0 :rgba 512 512 0 :rgba
:unsigned-byte (cffi:null-pointer))
+    (gl:generate-mipmap-ext :texture-2d)
+    (gl:bind-texture :texture-2d 0)
     (gl:framebuffer-texture-2d-ext :framebuffer-ext
                                    :color-attachment0-ext
                                    :texture-2d


diff -rN -u old-cl-opengl/glu/glu.lisp new-cl-opengl/glu/glu.lisp
--- old-cl-opengl/glu/glu.lisp  2006-11-13 04:30:03.000000000 -0600
+++ new-cl-opengl/glu/glu.lisp  2006-11-13 04:30:03.000000000 -0600
@@ -55,6 +55,7 @@
  (defcfun ("gluGetString" get-string) :string
   (name-keyword string-name))

+#-win32
  (defcfun ("gluCheckExtension" check-extension) (:boolean gl:boolean)
   (extension-name :string)
   (extension-string :string))
@@ -151,6 +152,7 @@
   (obj-y (:pointer gl:double))
   (obj-z (:pointer gl:double)))

+#-win32
  (defcfun ("gluUnProject4" %gluUnProject4) glu-result
   (win-x gl:ensure-double)
   (win-y gl:ensure-double)



More information about the cl-opengl-devel mailing list