[cl-opengl-devel] extension loading + wrapper generation
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)
On Nov 13, 2006, at 2:52 AM, Bart Botta wrote:
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.
I started doing this for new functions that I added bindings for because it was more self-documenting. The previous convention had been to add the pointer type in comments after the argument, which is less than ideal IMHO. Personally I prefer to parameterize the pointer type, but it does indeed require a more recent CFFI. One advantage to this is that when a type checking system is (someday) added to CFFI, the OpenGL bindings should be able to take advantage of it if the pointers are typed. James
On 11/13/06, Bart Botta <00003b@gmail.com> wrote:
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...
Unfortunately I don't time at the moment to test your stuff but your description looks cool. I've applied your patches. Unfortunately, I don't seem to have the EXT_framebuffer_object extension so I couldn't test the render-to-texture example. I hope it didn't break. We should look into giving you repository access. Getting a common-lisp.net account would be the first step if you don't have one already. -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/
participants (3)
-
Bart Botta
-
James J Bielman
-
Luís Oliveira