summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/render/model.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/chickadee/render/model.scm b/chickadee/render/model.scm
index 332d211..9f29240 100644
--- a/chickadee/render/model.scm
+++ b/chickadee/render/model.scm
@@ -377,10 +377,15 @@
((u)
(vec2 (string->number u) 0.0))
((u v)
- (vec2 (string->number u) (string->number v)))
+ ;; OBJ texture coordinates use the
+ ;; top-left of the image as the origin,
+ ;; but OpenGL uses the bottom-left, so
+ ;; all V values must be inverted.
+ (vec2 (string->number u)
+ (- 1.0 (string->number v))))
((u v w)
(vec2 (string->number u)
- (string->number v)))
+ (- 1.0 (string->number v))))
(_
(parse-error "wrong number of texcoord arguments" args)))))
(define (parse-normal args)