RenderContextWebGL(CanvasElement canvasElement, { bool alpha: false, bool antialias: false })
Source
RenderContextWebGL(CanvasElement canvasElement, {
bool alpha: false, bool antialias: false }) : _canvasElement = canvasElement {
_canvasElement.onWebGlContextLost.listen(_onContextLost);
_canvasElement.onWebGlContextRestored.listen(_onContextRestored);
var renderingContext = _canvasElement.getContext3d(
alpha: alpha, antialias: antialias,
depth: false, stencil: true,
premultipliedAlpha: true, preserveDrawingBuffer: false);
if (renderingContext is! gl.RenderingContext) {
throw new StateError("Failed to get WebGL context.");
}
_renderingContext = renderingContext;
_renderingContext.enable(gl.BLEND);
_renderingContext.disable(gl.STENCIL_TEST);
_renderingContext.disable(gl.DEPTH_TEST);
_renderingContext.disable(gl.CULL_FACE);
_renderingContext.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
_renderingContext.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
_activeRenderProgram = renderProgramSimple;
_activeRenderProgram.activate(this);
_contextValid = true;
_contextIdentifier = ++_globalContextIdentifier;
this.reset();
}