From c663963d2d0acdee50b6290d4ce94cb94d8d323a Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 24 Jan 2015 12:11:46 -0500 Subject: render: mesh: Support streaming vertex buffers. * sly/render/mesh.scm (make-vertex-buffer): Add 'stream?' argument. --- sly/render/mesh.scm | 9 ++++++--- 1 file 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)) ;;; -- cgit v1.2.3