Permalink
Browse files

Change behaviour of vertex arrays to allow :normalize spec.

If given, values are forced to float ranges, even for integer types.
If not given, integer types are handled by vertex-attrib-ipointer as appropriate
  • Loading branch information...
Shinmera committed Oct 17, 2018
1 parent 60b4814 commit e1c095a1275b390f0462ac2441c184cec2d99623
Showing with 4 additions and 2 deletions.
  1. +4 −2 resources/vertex-array.lisp
@@ -34,7 +34,7 @@
(size 3)
(stride 0)
(offset 0)
(normalized NIL)
(normalize NIL)
(instancing 0))
(enlist binding)
(check-allocated buffer)
@@ -45,7 +45,9 @@
(setf (size array) (size buffer)))
(decf i))
(:array-buffer
(gl:vertex-attrib-pointer index size (element-type buffer) normalized stride offset)
(if (or normalize (find (element-type buffer) '(:half-float :float :double)))
(gl:vertex-attrib-pointer index size (element-type buffer) normalize stride offset)
(gl:vertex-attrib-ipointer index size (element-type buffer) stride offset))
(gl:enable-vertex-attrib-array index)
(%gl:vertex-attrib-divisor index instancing)))))
(gl:bind-vertex-array 0)

0 comments on commit e1c095a

Please sign in to comment.