@@ -39,6 +39,12 @@ THREE.WebGLRenderer3 = function ( parameters ) {
gl = canvas.getContext( 'webgl', attributes ) || canvas.getContext( 'experimental-webgl', attributes );
+ if ( gl === null ) {
+
+ throw 'Error creating WebGL context.';
+ }
} catch ( exception ) {
console.error( exception );
@@ -6692,7 +6692,17 @@ THREE.WebGLRenderer = function ( parameters ) {
try {
- if ( ! ( _gl = _canvas.getContext( 'experimental-webgl', { alpha: _alpha, premultipliedAlpha: _premultipliedAlpha, antialias: _antialias, stencil: _stencil, preserveDrawingBuffer: _preserveDrawingBuffer } ) ) ) {
+ var attributes = {
+ alpha: _alpha,
+ premultipliedAlpha: _premultipliedAlpha,
+ antialias: _antialias,
+ stencil: _stencil,
+ preserveDrawingBuffer: _preserveDrawingBuffer
+ };
+ _gl = _canvas.getContext( 'webgl', attributes ) || _canvas.getContext( 'experimental-webgl', attributes );
+ if ( _gl === null ) {
throw 'Error creating WebGL context.';