render: buffer: Use correct data type for index buffer when rendering.
authorDavid Thompson <dthompson2@worcester.edu>
Thu, 6 Sep 2018 13:33:19 +0000 (09:33 -0400)
committerDavid Thompson <dthompson2@worcester.edu>
Thu, 6 Sep 2018 13:33:19 +0000 (09:33 -0400)
* chickadee/render/buffer.scm (render-vertices): Use the index buffer
  type rather than assuming it is always unsigned-int.

chickadee/render/buffer.scm

index 9635db6..48362f0 100644 (file)
@@ -516,9 +516,9 @@ be specified for the buffer."
 
 (define* (render-vertices array #:optional count)
   (gpu-state-set! *vertex-array-state* array)
-  (gl-draw-elements (vertex-array-mode-gl array)
-                    (or count
-                        (typed-buffer-length
-                         (vertex-array-indices array)))
-                    (data-type unsigned-int)
-                    %null-pointer))
+  (let ((indices (vertex-array-indices array)))
+    (gl-draw-elements (vertex-array-mode-gl array)
+                      (or count
+                          (typed-buffer-length indices))
+                      (typed-buffer-type-gl indices)
+                      %null-pointer)))