/** * @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.requestAnimFrame(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. */ export declare class WebGLUtils { /** * Creates the HTLM for a failure message * @param {string} canvasContainerId id of container of th * canvas. * @return {string} The html. */ private static makeFailHTML; /** * Mesasge for getting a webgl browser * @type {string} */ private static GET_A_WEBGL_BROWSER; /** * Mesasge for need better hardware * @type {string} */ private static OTHER_PROBLEM; /** * 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} opt_attribs Any * creation attributes you want to pass in. * @param {function:(msg)} opt_onError An function to call * if there is an error during creation. * @return {WebGLRenderingContext} The created context. */ static setupWebGL(canvas: HTMLCanvasElement, attribs?: {}, onError?: (msg: string) => void): WebGLRenderingContext; /** * Creates a webgl context. * @param {!Canvas} canvas The canvas tag to get context * from. If one is not passed in one will be created. * @return {!WebGLContext} The created context. */ static create3DContext(canvas: HTMLCanvasElement, opt_attribs?: {}): WebGLRenderingContext; }