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.

reference

Jump to: navigation, search

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