1 (defpackage #:cl-glfw-opengl-extensions
4 (:export
#:scan-available-extensions
#:available-extensions
#:extension-available-p
#:load-extension
))
8 (defparameter *available
* nil
)
10 (defun scan-available-extensions ()
12 (mapcar #'(lambda (ext-name) (subseq (symbol-name ext-name
) 3))
13 (let ((*readtable
* (copy-readtable nil
)))
14 (setf (readtable-case *readtable
*) :preserve
)
15 (read-from-string (format nil
"(~a)" (gl:get-string gl
:+extensions
+)))))))
17 (defun available-extensions ()
18 (if (and *available
* (not (equal *available
* '(""))) (not (eql *available
* '(nil))))
20 (scan-available-extensions)))
22 (defun extension-available-p (extension)
23 (declare (type string extension
))
24 (find extension
(available-extensions) :test
'equalp
))
26 (defun load-extension (extension)
27 "Try to load an opengl extension where the extension name is a string of the form
28 \"ARB_vertex_buffer_object\". Returns t if the extension is available and loads,
30 (let ((extension (extension-available-p extension
)))
33 (asdf:oos
'asdf
:load-op
(string-downcase (format nil
"cl-glfw-opengl-~a" extension
)))
34 (asdf:missing-component
() (warn "Extension ~a has nothing to load~%" extension
)))