Notice: The WebPlatform project has been discontinued when the Stewards partnership agreement ended in September 2015. This site has been frozen, and the assets we have created will remain.



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


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


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

Return Value

A context object or null.


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