Merge pull request #19 from leo6104/master

add exception for WebGL not supported
This commit is contained in:
Leon Chen
2016-10-23 20:00:52 -04:00
committed by GitHub
2 changed files with 18 additions and 14 deletions
+14 -14
View File
File diff suppressed because one or more lines are too long
+4
View File
@@ -1,4 +1,8 @@
const canvas = document.createElement('canvas')
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
if(!gl) {
throw new Error('Unable to initialize WebGL. Your browser may not support it.')
}
export const MAX_TEXTURE_SIZE = gl.getParameter(gl.MAX_TEXTURE_SIZE)