Просмотр исходного кода

WebGLRenderer: Check if context gets created with default attributes. Closes #5467.

Mr.doob 11 лет назад
Родитель
Сommit
bde5f99b71
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      src/renderers/WebGLRenderer.js

+ 9 - 1
src/renderers/WebGLRenderer.js

@@ -199,7 +199,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( _gl === null ) {
 
-			throw 'Error creating WebGL context.';
+			if ( _canvas.getContext( 'webgl') !== null ) {
+
+				throw 'Error creating WebGL context with your selected attributes.';
+
+			} else {
+
+				throw 'Error creating WebGL context.';
+
+			}
 
 		}