Browse Source

Merge pull request #569 from russellp17/fix-empty-texture-error-on-empty-canvas

Fix "empty textures" error on empty canvas
David Sehnal 2 years ago
parent
commit
c6fe440a01
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/mol-canvas3d/passes/passes.ts

+ 4 - 1
src/mol-canvas3d/passes/passes.ts

@@ -24,7 +24,10 @@ export class Passes {
 
     updateSize() {
         const { gl } = this.webgl;
-        this.draw.setSize(gl.drawingBufferWidth, gl.drawingBufferHeight);
+        // Avoid setting dimensions to 0x0 because it causes "empty textures are not allowed" error.
+        const width = Math.max(gl.drawingBufferWidth, 2);
+        const height = Math.max(gl.drawingBufferHeight, 2);
+        this.draw.setSize(width, height);
         this.pick.syncSize();
         this.multiSample.syncSize();
     }