diff options
author | Colin Okay <colin@cicadas.surf> | 2022-06-29 11:54:24 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-06-29 11:54:24 -0500 |
commit | 82f71b0d13788b1cff9a24c5b652effd11631523 (patch) | |
tree | f0ec127b2f10f46029983ee95b6c72ef29bc504c /src/gl/util.lisp | |
parent | 4d1ee56c96ce254134b692f0e3b3271c87a42b54 (diff) |
[refactor] [structure] modularized project file structure
Diffstat (limited to 'src/gl/util.lisp')
-rw-r--r-- | src/gl/util.lisp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gl/util.lisp b/src/gl/util.lisp new file mode 100644 index 0000000..bff2f88 --- /dev/null +++ b/src/gl/util.lisp @@ -0,0 +1,19 @@ +;;;; gl/util.lisp + +(in-package #:wheelwork) + +(define-symbol-macro +float-size+ + (cffi:foreign-type-size :float)) + +(defun gl-array (type &rest contents) + (let ((array (gl:alloc-gl-array type (length contents)))) + (dotimes (i (length contents) array) + (setf (gl:glaref array i) (elt contents i))))) + +(defmacro with-gl-array ((var type &rest contents) &body body) + `(let ((,var (gl-array ,type ,@contents))) + (unwind-protect (progn ,@body) + (gl:free-gl-array ,var)))) + + + |