summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/texture.scm19
1 files changed, 17 insertions, 2 deletions
diff --git a/chickadee/graphics/texture.scm b/chickadee/graphics/texture.scm
index e7342db..5b46af1 100644
--- a/chickadee/graphics/texture.scm
+++ b/chickadee/graphics/texture.scm
@@ -202,7 +202,15 @@ Currently only 32-bit RGBA format is supported."
(texture-parameter-name texture-min-filter)
(match min-filter
('nearest (gl:texture-min-filter nearest))
- ('linear (gl:texture-min-filter linear))))
+ ('linear (gl:texture-min-filter linear))
+ ('nearest-mipmap-nearest
+ (gl:texture-min-filter nearest-mipmap-nearest))
+ ('linear-mipmap-nearest
+ (gl:texture-min-filter linear-mipmap-nearest))
+ ('nearest-mipmap-linear
+ (gl:texture-min-filter nearest-mipmap-linear))
+ ('linear-mipmap-linear
+ (gl:texture-min-filter linear-mipmap-linear))))
(gl-texture-parameter (texture-target texture-2d)
(texture-parameter-name texture-mag-filter)
(match mag-filter
@@ -219,7 +227,14 @@ Currently only 32-bit RGBA format is supported."
(match format
('rgba (pixel-format rgba)))
(color-pointer-type unsigned-byte)
- (or pixels %null-pointer)))
+ (or pixels %null-pointer))
+ ;; Generate mipmaps, if needed.
+ (when (memq min-filter
+ '(nearest-mipmap-nearest
+ linear-mipmap-nearest
+ nearest-mipmap-linear
+ linear-mipmap-linear))
+ (gl-generate-mipmap (texture-target texture-2d))))
texture))
(define (make-texture-region texture rect)