question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebGLRenderer: WebGL fallback from WebGL2 does not honor context attributes

See original GitHub issue

Consequently, the attributes must be repeated to take effect.

var canvas = document.createElement( 'canvas' );

var context = canvas.getContext( 'webgl2', { alpha: true } );

renderer = new THREE.WebGLRenderer( { canvas: canvas, context: context, alpha: true } );
  • [ x ] Dev
  • [ x ] r115

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mrdoobcommented, Apr 5, 2020

This is messy… Maybe it’s time to start supporting WebGL2 by default?

2reactions
finnbearcommented, Apr 8, 2020

Agree that a change needs to be made (default webgl2 sounds great) but, until then, it is possible to use ES6 syntax to work around the issue:

const canvas = document.createElement( 'canvas' );
const params = {alpha: true, antialias: true, stencil: true};
const context = canvas.getContext('webgl2', params);
const renderer = new THREE.WebGLRenderer({canvas, context, ...params});
Read more comments on GitHub >

github_iconTop Results From Across the Web

WebGLRenderer – three.js docs
The WebGL renderer displays your beautifully crafted scenes using WebGL. ... If not passed in here, a new canvas element will be created....
Read more >
WebGL Specification - Khronos Registry
The actual context parameters are set to the attributes of the created drawing buffer. The alpha , premultipliedAlpha and preserveDrawingBuffer ...
Read more >
Three.js detect webgl support and fallback to regular canvas
Yes, it's possible. You can use CanvasRenderer instead of WebGLRenderer . About WebGL detection: 1) Read this WebGL wiki article: ...
Read more >
WebGL2RenderingContext - Web APIs | MDN
Chrome Edge WebGL2RenderingContext Full support. Chrome56. Toggle history Full support. Edge79. T... activeTexture Full support. Chrome56. Toggle history Full support. Edge79. T... attachShader Full support. Chrome56....
Read more >
layers.amd-switchable-gfx.enabled - ADMX Help
Registry Hive, HKEY_LOCAL_MACHINE. Registry Path, Software\Policies\Mozilla\lockPref. Value Name, layers.amd-switchable-gfx.enabled. Value Type, REG_DWORD.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found