summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sly/render/mesh.scm16
1 files changed, 9 insertions, 7 deletions
diff --git a/sly/render/mesh.scm b/sly/render/mesh.scm
index dc1a1ca..7a34ee5 100644
--- a/sly/render/mesh.scm
+++ b/sly/render/mesh.scm
@@ -44,12 +44,13 @@
;;;
(define-record-type <vertex-buffer>
- (%make-vertex-buffer id type attr-size length)
+ (%make-vertex-buffer id type attr-size length data)
vertex-buffer?
(id vertex-buffer-id)
(type vertex-buffer-type)
(attr-size vertex-buffer-attr-size)
- (length vertex-buffer-length))
+ (length vertex-buffer-length)
+ (data vertex-buffer-data))
(define (generate-vertex-buffer)
(let ((bv (u32vector 1)))
@@ -118,11 +119,12 @@
(arb-vertex-buffer-object array-buffer-arb)))
(define* (make-vertex-buffer vertices #:optional (index? #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))))
+ (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)))
(with-vertex-buffer vbo
(glBufferData (vertex-buffer-type vbo)
(bytevector-length bv)