summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-05-10 17:10:21 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-05-10 17:10:21 -0400
commit3fcb95594e71601ea6f02f3a0fe2480cbbde6e4b (patch)
treeec0021e54972d3a7eec8486cb049c5aa2d2615b3
parente5a5d5be4688e9194de1eab18f91a92f7903218e (diff)
graphics: texture: Explicitly set active texture unit in make-texture.
Avoids bugs that occur when OpenGL state isn't what we think it is.
-rw-r--r--chickadee/graphics/texture.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/chickadee/graphics/texture.scm b/chickadee/graphics/texture.scm
index b9efd17..56843ad 100644
--- a/chickadee/graphics/texture.scm
+++ b/chickadee/graphics/texture.scm
@@ -187,8 +187,10 @@ Currently only 32-bit RGBA format is supported."
(make-rect 0.0 1.0 1.0 -1.0)
(make-rect 0.0 0.0 1.0 1.0)))))
(graphics-engine-guard! texture)
- (with-graphics-state ((g:texture-0 texture))
- (graphics-engine-commit!)
+ (with-graphics-state! ((g:texture-0 texture))
+ ;; Ensure that we are using texture unit 0 because
+ ;; with-graphics-state! doesn't guarantee it.
+ (set-gl-active-texture (version-1-3 texture0))
(gl-texture-parameter (texture-target texture-2d)
(texture-parameter-name texture-min-filter)
(match min-filter