Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

reference

Specification

Khronos publishes the WebGL Specification and the WebGL quick reference card.

WebGL Context

A webgl context can be obtained by calling the getContext function on a Canvas Element

Syntax

var gl = canvas.getContext('webgl', attributes) || canvas.getContext('experimental-webgll', attributes)

Arguments

  1. DOMString: ‘webgl’ or ‘experimental-webgl’
  2. Object: WebGLContextAttributes

Return Value

A context object or null.

WebGLContextAttributes

  • boolean alpha: default true
  • boolean depth: default true
  • boolean stencil: default false
  • boolean antialias: default true
  • boolean premultipliedAlpha: default true
  • boolean preserveDrawingBuffer: default false