/** * @fileoverview This file contains functions every webgl program will need * a version of one way or another. * * Instead of setting up a context manually it is recommended to * use. This will check for success or failure. On failure it * will attempt to present an approriate message to the user. * * gl = WebGLUtils.setupWebGL(canvas); * * For animated WebGL apps use of setTimeout or setInterval are * discouraged. It is recommended you structure your rendering * loop like this. * * function render() { * window.requestAnimationFrame(render, canvas); * * // do rendering * ... * } * render(); * * This will call your rendering function up to the refresh rate * of your display but will stop rendering if your app is not * visible. */ /** * Creates a webgl context. * @param {!Canvas} canvas The canvas tag to get context * from. If one is not passed in one will be created. * @param {!WebGLContextCreationAttirbutes} optAttribs * creation attributes you want to pass in. * @return {!WebGLContext} The created context. */ export declare function create3DContext(canvas: HTMLCanvasElement, optAttribs: WebGLContextAttributes): WebGL2RenderingContext | CanvasRenderingContext2D | null; /** * Creates a webgl context. If creation fails it will * change the contents of the container of the * tag to an error message with the correct links for WebGL. * @param {Element} canvas. The canvas element to create a * context from. * @param {WebGLContextCreationAttirbutes} optAttribs Any * creation attributes you want to pass in. * @param {function:(msg)} optOnError An function to call * if there is an error during creation. * @return {WebGL2RenderingContext} The created context. */ export declare function setupWebGL(canvas: Element, optAttribs?: WebGLContextAttributes, optOnError?: (msg: string) => any): WebGL2RenderingContext | CanvasRenderingContext2D | null;