diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-01-24 12:11:46 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-01-26 17:40:59 -0500 |
commit | c663963d2d0acdee50b6290d4ce94cb94d8d323a (patch) | |
tree | 304bc1b31a90debbb43bd61fc6016a530c80b7ff | |
parent | aeb2a61f9d231ef3106f4f25d815d64d2649fbb8 (diff) |
render: mesh: Support streaming vertex buffers.
* sly/render/mesh.scm (make-vertex-buffer): Add 'stream?' argument.
-rw-r--r-- | sly/render/mesh.scm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sly/render/mesh.scm b/sly/render/mesh.scm index 7a34ee5..fa57bb9 100644 --- a/sly/render/mesh.scm +++ b/sly/render/mesh.scm @@ -118,18 +118,21 @@ (arb-vertex-buffer-object element-array-buffer-arb) (arb-vertex-buffer-object array-buffer-arb))) -(define* (make-vertex-buffer vertices #:optional (index? #f)) +(define* (make-vertex-buffer vertices #:optional (index? #f) (stream? #f)) (let* ((bv (vertices-bytevector vertices index?)) (vbo (%make-vertex-buffer (generate-vertex-buffer) (gl-buffer-type index?) (attribute-size (vector-ref vertices 0)) (vector-length vertices) - bv))) + bv)) + (usage (if stream? + (arb-vertex-buffer-object static-draw-arb) + (arb-vertex-buffer-object stream-draw-arb)))) (with-vertex-buffer vbo (glBufferData (vertex-buffer-type vbo) (bytevector-length bv) (bytevector->pointer bv) - (arb-vertex-buffer-object static-draw-arb))) + usage)) vbo)) ;;; |