getContext3d method

  1. @SupportedBrowser(SupportedBrowser.CHROME)
  2. @SupportedBrowser(SupportedBrowser.FIREFOX)
RenderingContext getContext3d({
  1. bool alpha = true,
  2. bool depth = true,
  3. bool stencil = false,
  4. bool antialias = true,
  5. bool premultipliedAlpha = true,
  6. bool preserveDrawingBuffer = false,
})

Returns a new Web GL context for this canvas.

Other resources

Implementation

@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
gl.RenderingContext getContext3d({
  bool alpha = true,
  bool depth = true,
  bool stencil = false,
  bool antialias = true,
  bool premultipliedAlpha = true,
  bool preserveDrawingBuffer = false,
}) {
  var options = {
    'alpha': alpha,
    'depth': depth,
    'stencil': stencil,
    'antialias': antialias,
    'premultipliedAlpha': premultipliedAlpha,
    'preserveDrawingBuffer': preserveDrawingBuffer,
  };
  var context = getContext('webgl', options);
  context ??= getContext('experimental-webgl', options);
  return context as gl.RenderingContext;
}