Home

function: autoDetectRenderer


autoDetectRenderer(options: object): PIXI.WebGLRenderer, PIXI.CanvasRenderer

This helper function will automatically detect which renderer you should be using.
WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by
the browser then this function will return a canvas renderer

Params:

Name Type Attribute Description
options

The optional renderer parameters

options.width

the width of the renderers view

options.height

the height of the renderers view

options.view

the canvas to use as a view, optional

options.transparent

If the render view is transparent, default false

options.antialias

sets antialias (only applicable in chrome at the moment)

options.preserveDrawingBuffer

enables drawing buffer preservation, enable this if you
need to call toDataUrl on the webgl context

options.resolution

The resolution / device pixel ratio of the renderer, retina would be 2

options.forceCanvas

prevents selection of WebGL renderer, even if such is present

Returns:

PIXI.WebGLRenderer, PIXI.CanvasRenderer

  {
    "comment": "/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment)\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n *      need to call toDataUrl on the webgl context\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present\n * @return {PIXI.WebGLRenderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */",
    "meta": {
        "range": [
            200,
            1507
        ],
        "filename": "autoDetectRenderer.js",
        "lineno": 6,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\pixi.js\\pixi.js-repo\\src\\core",
        "code": {}
    },
    "description": "

This helper function will automatically detect which renderer you should be using.
WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by
the browser then this function will return a canvas renderer

", "memberof": "PIXI", "kind": "function", "name": "autoDetectRenderer", "params": [ { "type": { "names": [ "object" ] }, "optional": true, "description": "

The optional renderer parameters

", "name": "options" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 800, "description": "

the width of the renderers view

", "name": "options.width" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 600, "description": "

the height of the renderers view

", "name": "options.height" }, { "type": { "names": [ "HTMLCanvasElement" ] }, "optional": true, "description": "

the canvas to use as a view, optional

", "name": "options.view" }, { "type": { "names": [ "boolean" ] }, "optional": true, "defaultvalue": false, "description": "

If the render view is transparent, default false

", "name": "options.transparent" }, { "type": { "names": [ "boolean" ] }, "optional": true, "defaultvalue": false, "description": "

sets antialias (only applicable in chrome at the moment)

", "name": "options.antialias" }, { "type": { "names": [ "boolean" ] }, "optional": true, "defaultvalue": false, "description": "

enables drawing buffer preservation, enable this if you
need to call toDataUrl on the webgl context

", "name": "options.preserveDrawingBuffer" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 1, "description": "

The resolution / device pixel ratio of the renderer, retina would be 2

", "name": "options.resolution" }, { "type": { "names": [ "boolean" ] }, "optional": true, "defaultvalue": false, "description": "

prevents selection of WebGL renderer, even if such is present

", "name": "options.forceCanvas" } ], "returns": [ { "type": { "names": [ "PIXI.WebGLRenderer", "PIXI.CanvasRenderer" ] }, "description": "

Returns WebGL renderer if available, otherwise CanvasRenderer

" } ], "scope": "static", "longname": "PIXI.autoDetectRenderer", "___id": "T000002R000158", "___s": true, "filepath": "core\\autoDetectRenderer.js" }