Browse Source

check if WEBGL_depth_texture is supported

Alexander Rose 3 years ago
parent
commit
d602415e98
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/mol-gl/webgl/texture.ts

+ 4 - 0
src/mol-gl/webgl/texture.ts

@@ -238,6 +238,10 @@ export function createTexture(gl: GLRenderingContext, extensions: WebGLExtension
         throw new Error(`texture kind '${kind}' and type '${_type}' are incompatible`);
     }
 
+    if (!extensions.depthTexture && _format === 'depth') {
+        throw new Error(`extension 'WEBGL_depth_texture' needed for 'depth' texture format`);
+    }
+
     const target = getTarget(gl, kind);
     const filter = getFilter(gl, _filter);
     const format = getFormat(gl, _format, _type);