[cl-opengl-devel] GLenum return values
Bart Botta
00003b at gmail.com
Fri Sep 11 19:27:48 UTC 2009
Currently a number of functions in cl-opengl return %gl:enum, but
cffi:defcenum only remembers 1 keyword for a particular enum value, so
we can't reliably compare the return values with keywords. (see for
example http://paste.lisp.org/display/86945 where one of the examples
broke when I updated to the newest gl .spec version, which changed
what symbol the enum mapped to).
Does anyone have objections (or better alternatives) to changing the
return values to integers, and either adding a function to compare
them (gl:enum= maybe?) to keywords, or adding a shortcut to look up an
enum (probably gl:enum)?
so the code from the paste would look like
(let ((framebuffer-status (gl:check-framebuffer-status-ext :framebuffer-ext)))
(unless (gl:enum= framebuffer-status :framebuffer-complete-ext)
(error "Framebuffer not complete: ~A." framebuffer-status)))
or
(let ((framebuffer-status (gl:check-framebuffer-status-ext :framebuffer-ext)))
(unless (= framebuffer-status (gl:enum :framebuffer-complete-ext))
(error "Framebuffer not complete: ~A." framebuffer-status)))
Alternately, cffi could be modified as suggested in the comment for
cffi::make-foreign-enum to return a list of keywords when there are
duplicates, but then we would have do modify the calling code anyway
to use MEMBER or something, and that would be slower as well as less
intuitive.
-b-
More information about the cl-opengl-devel
mailing list