Browse Source

fix a texture binding bug for GLES2/WebGL in the new clear-bind-slot code

Andre Weissflog 6 years ago
parent
commit
b0ad2e9426
1 changed files with 10 additions and 2 deletions
  1. 10 2
      sokol_gfx.h

+ 10 - 2
sokol_gfx.h

@@ -2,6 +2,8 @@
 /*
     sokol_gfx.h -- simple 3D API wrapper
 
+    Project URL: https://github.com/floooh/sokol
+
     Do this:
         #define SOKOL_IMPL
     before you include this file in *one* C or C++ file to create the
@@ -81,6 +83,10 @@
 
         https://github.com/floooh/sokol-samples
 
+    For an optional shader-cross-compile solution, see:
+
+        https://github.com/floooh/sokol-tools/blob/master/docs/sokol-shdc.md
+
 
     STEP BY STEP
     ============
@@ -3886,8 +3892,10 @@ _SOKOL_PRIVATE void _sg_gl_clear_texture_bindings(bool force) {
             glBindTexture(GL_TEXTURE_2D, 0);
             glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
             #if !defined(SOKOL_GLES2)
-            glBindTexture(GL_TEXTURE_3D, 0);
-            glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
+            if (!_sg.gl.gles2) {
+                glBindTexture(GL_TEXTURE_3D, 0);
+                glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
+            }
             #endif
             _sg.gl.cache.textures[i].target = 0;
             _sg.gl.cache.textures[i].texture = 0;