summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/render/buffer.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/chickadee/render/buffer.scm b/chickadee/render/buffer.scm
index 83a2925..5d13c2e 100644
--- a/chickadee/render/buffer.scm
+++ b/chickadee/render/buffer.scm
@@ -77,7 +77,8 @@
vertex-array-mode
null-vertex-array
*vertex-array-state*
- render-vertices))
+ render-vertices
+ render-vertices/instanced))
;;;
;;; Buffers
@@ -529,3 +530,13 @@ which attributes advance when rendering multiple instances."
(typed-buffer-length indices))
(typed-buffer-type-gl indices)
%null-pointer)))
+
+(define* (render-vertices/instanced array instances #:optional count)
+ (gpu-state-set! *vertex-array-state* array)
+ (let ((indices (vertex-array-indices array)))
+ (gl-draw-elements-instanced (vertex-array-mode-gl array)
+ (or count
+ (typed-buffer-length indices))
+ (typed-buffer-type-gl indices)
+ %null-pointer
+ instances)))