提交 f6681280 编写于 作者: M Mr.doob

WebGLRenderer: Try to initialise 'webgl' context too. WebGLRenderer3: Check if gl is null.

上级 cd0b0e89
......@@ -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.';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册