diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-07-06 16:42:16 -0400 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-07-06 16:42:16 -0400 |
commit | 9d6d69e8067a8f10e155b271021f78a3cf7e8609 (patch) | |
tree | 9672ab9e98292ace85ce47f6425108efa82f037e /2d/texture.scm | |
parent | 29adec1693fd4dd8135e2b0ae9733eeb822978b0 (diff) |
Add optional texture coordinate parameters to texture-quad and sprite-batch-draw.
Diffstat (limited to '2d/texture.scm')
-rw-r--r-- | 2d/texture.scm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/2d/texture.scm b/2d/texture.scm index 0db72a2..2276025 100644 --- a/2d/texture.scm +++ b/2d/texture.scm @@ -108,20 +108,21 @@ Currently only works with RGBA format surfaces." "Loads a texture from a file." (surface->texture (SDL:load-image filename))) -(define* (texture-quad texture x y w h #:optional (color '(1 1 1))) +(define* (texture-quad texture x y w h #:optional (color '(1 1 1)) + (u 0) (v 0) (u2 1) (v2 1)) "Renders a textured quad." (let ((x2 (+ x w)) (y2 (+ y h))) (with-gl-bind-texture (texture-target texture-2d) (texture-id texture) (gl-begin (begin-mode quads) (apply gl-color color) - (gl-texture-coordinates 0 0) + (gl-texture-coordinates u v) (gl-vertex x y) - (gl-texture-coordinates 1 0) + (gl-texture-coordinates u2 v) (gl-vertex x2 y) - (gl-texture-coordinates 1 1) + (gl-texture-coordinates u2 v2) (gl-vertex x2 y2) - (gl-texture-coordinates 0 1) + (gl-texture-coordinates u v2) (gl-vertex x y2))))) ;;; |