_onContextChange()
    {
        const gl = this.renderer.gl;

        this._destroyGlObjects(true);

        // check max textures the GPU can handle.
        this._maxTextures = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), SpriteRenderer.MAX_TEXTURE_COUNT);

        // check the maximum number of if statements shaders are allowed *up to* the max textures.
        this._maxTextures = util.getMaxIfStatmentsInShader(gl, this._maxTextures);

        this.shaders.length = this._maxTextures;
        this.shaders[0] = this.shaders[0] || generateMultiTextureShader(this.renderer, 1);
        this.shaders[1] = this.shaders[1] || generateMultiTextureShader(this.renderer, 2);

        // create new index buffer
        this.indexBuffer = glutil.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);

        // we use the second shader as the first one depending on your browser may omit aTextureId
        // as it is not used by the shader so is optimized out.
        const attribs = this.shaders[1].attributes;
        const maxVaos = this.vertexBuffers.length || this.startNumVaos;

        // create initial vertex buffers and VAOs
        for (let i = 0; i < maxVaos; ++i)
        {
            this._createVao(gl, attribs);
        }

        this.vao = this.vaos[0];
    }
/**
     * Called by base Manager class when there is a WebGL context change.
     *
     * @private
     */
Called by base Manager class when there is a WebGL context change.
@private
Called by base Manager class when there is a WebGL context change . @private
_onContextChange()
    {
        const gl = this.renderer.gl;
        this._destroyGlObjects(true);
        this._maxTextures = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), SpriteRenderer.MAX_TEXTURE_COUNT);
        this._maxTextures = util.getMaxIfStatmentsInShader(gl, this._maxTextures);
        this.shaders.length = this._maxTextures;
        this.shaders[0] = this.shaders[0] || generateMultiTextureShader(this.renderer, 1);
        this.shaders[1] = this.shaders[1] || generateMultiTextureShader(this.renderer, 2);
        this.indexBuffer = glutil.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);
        const attribs = this.shaders[1].attributes;
        const maxVaos = this.vertexBuffers.length || this.startNumVaos;
        for (let i = 0; i < maxVaos; ++i)
        {
            this._createVao(gl, attribs);
        }
        this.vao = this.vaos[0];
    }
_onContextChange ( ) { const gl = this . renderer . gl ; this . _destroyGlObjects ( true ) ; this . _maxTextures = Math . min ( gl . getParameter ( gl . MAX_TEXTURE_IMAGE_UNITS ) , SpriteRenderer . MAX_TEXTURE_COUNT ) ; this . _maxTextures = util . getMaxIfStatmentsInShader ( gl , this . _maxTextures ) ; this . shaders . length = this . _maxTextures ; this . shaders [ 0 ] = this . shaders [ 0 ] || generateMultiTextureShader ( this . renderer , 1 ) ; this . shaders [ 1 ] = this . shaders [ 1 ] || generateMultiTextureShader ( this . renderer , 2 ) ; this . indexBuffer = glutil . GLBuffer . createIndexBuffer ( gl , this . indices , gl . STATIC_DRAW ) ; const attribs = this . shaders [ 1 ] . attributes ; const maxVaos = this . vertexBuffers . length || this . startNumVaos ; for ( let i = 0 ; i < maxVaos ; ++ i ) { this . _createVao ( gl , attribs ) ; } this . vao = this . vaos [ 0 ] ; }
Called by base Manager class when there is a WebGL context change.
Called by base Manager class when there is a WebGL context change .
// check max textures the GPU can handle. // check the maximum number of if statements shaders are allowed *up to* the max textures. // create new index buffer // we use the second shader as the first one depending on your browser may omit aTextureId // as it is not used by the shader so is optimized out. // create initial vertex buffers and VAOs