add exception for WebGL not supported

This commit is contained in:
HeoSangMin
2016-10-18 10:41:19 +09:00
parent c744785500
commit 8124e56d52
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)