Permalink
Browse files

Copyless with-foreign-matrix on non-clisp.

  • Loading branch information...
1 parent 6ac74f2 commit 7963546472181519f165a383143fe829c635c8e9 @Ralith committed Nov 1, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 gl/opengl.lisp
View
@@ -403,10 +403,13 @@ another buffer is bound within FORMS."
(import-export %gl:matrix-mode)
(defmacro with-foreign-matrix ((sym matrix) &body body)
- `(with-foreign-object (,sym '%gl:float 16)
- (dotimes (i 16)
- (setf (mem-aref ,sym '%gl:float i) (row-major-aref ,matrix i)))
- ,@body))
+ `(typecase ,matrix
+ #-clisp
+ ((simple-array single-float (*))
+ (with-pointer-to-vector-data (,sym ,matrix)
+ ,@body))
+ (t (dotimes (i 16)
+ (setf (mem-aref ,sym '%gl:float i) (row-major-aref ,matrix i))))))
(defun load-matrix (matrix)
(with-foreign-matrix (foreign-matrix matrix)

0 comments on commit 7963546

Please sign in to comment.