From 3fcb95594e71601ea6f02f3a0fe2480cbbde6e4b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 10 May 2021 17:10:21 -0400 Subject: graphics: texture: Explicitly set active texture unit in make-texture. Avoids bugs that occur when OpenGL state isn't what we think it is. --- chickadee/graphics/texture.scm | 6 ++++-- 1 file 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 -- cgit v1.2.3