-1

I'm trying to understand the behaviour of getContext() if I specify antialias: true, but the device doesn't support antialiasing. For example:

const gl = canvas.getContext('webgl', {
  antialias: true
})

Will a context still be returned in this case?

Tom--G
  • 51
  • 1
  • 8
  • 2
    Does this answer your question? [WebGL2 has anti-alias automatically built-in?](https://stackoverflow.com/questions/50255282/webgl2-has-anti-alias-automatically-built-in) – Nikolay Handzhiyski Oct 27 '21 at 15:59
  • 1
    That question is asking about WebGL 2 specifically, whereas I'm asking about WebGL 1 and 2. But yes, the accepted answer also applies here. – Tom--G Oct 29 '21 at 09:16

1 Answers1

2

The depth, stencil and antialias attributes, when set to true, are requests, not requirements. The WebGL implementation should make a best effort to honor them. When any of these attributes is set to false, however, the WebGL implementation must not provide the associated functionality. Combinations of attributes not supported by the WebGL implementation or graphics hardware shall not cause a failure to create a WebGLRenderingContext.

WebGL Specification

LJᛃ
  • 7,655
  • 2
  • 24
  • 35