Skip to content

Commit

Permalink
Change behaviour of vertex arrays to allow :normalize spec.
Browse files Browse the repository at this point in the history
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 e1c095a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions resources/vertex-array.lisp
Expand Up @@ -34,7 +34,7 @@
(size 3) (size 3)
(stride 0) (stride 0)
(offset 0) (offset 0)
(normalized NIL) (normalize NIL)
(instancing 0)) (instancing 0))
(enlist binding) (enlist binding)
(check-allocated buffer) (check-allocated buffer)
Expand All @@ -45,7 +45,9 @@
(setf (size array) (size buffer))) (setf (size array) (size buffer)))
(decf i)) (decf i))
(:array-buffer (: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:enable-vertex-attrib-array index)
(%gl:vertex-attrib-divisor index instancing))))) (%gl:vertex-attrib-divisor index instancing)))))
(gl:bind-vertex-array 0) (gl:bind-vertex-array 0)
Expand Down

0 comments on commit e1c095a

Please sign in to comment.