diff options
-rw-r--r-- | chickadee/render/texture.scm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/chickadee/render/texture.scm b/chickadee/render/texture.scm index 4214c70..e37e4ec 100644 --- a/chickadee/render/texture.scm +++ b/chickadee/render/texture.scm @@ -139,6 +139,7 @@ (gpu-state-set! (vector-ref *texture-states* n) texture)) (define* (make-texture pixels width height #:key + flip? (min-filter 'linear) (mag-filter 'linear) (wrap-s 'repeat) @@ -146,10 +147,13 @@ (format 'rgba)) "Translate the bytevector PIXELS into an OpenGL texture with dimensions WIDTHxHEIGHT where each pixel is in 32-bit RGBA format. -The generated texture uses MIN-FILTER for downscaling and MAG-FILTER -for upscaling. WRAP-S and WRAP-T are symbols that control how texture -access is handled for texture coordinates outside the [0, 1] range. -Allowed symbols are: repeat (the default), clamp, clamp-to-border, +The first pixe lin PIXELS corresponds to the upper-left corner of the +image. If this is not the case and the first pixel corresponds to the +lower-left corner of the image, set FLIP? to #t. The generated +texture uses MIN-FILTER for downscaling and MAG-FILTER for upscaling. +WRAP-S and WRAP-T are symbols that control how texture access is +handled for texture coordinates outside the [0, 1] range. Allowed +symbols are: repeat (the default), clamp, clamp-to-border, clamp-to-edge. FORMAT specifies the pixel format. Currently only 32-bit RGBA format is supported." (define (gl-wrap mode) @@ -164,7 +168,9 @@ clamp-to-edge. FORMAT specifies the pixel format. Currently only min-filter mag-filter wrap-s wrap-t 0 0 width height (make-rect 0.0 0.0 width height) - (make-rect 0.0 0.0 1.0 1.0))))) + (if flip? + (make-rect 1.0 1.0 -1.0 -1.0) + (make-rect 0.0 0.0 1.0 1.0)))))) (texture-set! 0 texture) (gl-texture-parameter (texture-target texture-2d) (texture-parameter-name texture-min-filter) |