popFilter()
    {
        const filterData = this.filterData;

        const lastState = filterData.stack[filterData.index - 1];
        const currentState = filterData.stack[filterData.index];

        this.quad.map(currentState.renderTarget.size, currentState.sourceFrame).upload();

        const filters = currentState.filters;

        if (filters.length === 1)
        {
            filters[0].apply(this, currentState.renderTarget, lastState.renderTarget, false, currentState);
            this.freePotRenderTarget(currentState.renderTarget);
        }
        else
        {
            let flip = currentState.renderTarget;
            let flop = this.getPotRenderTarget(
                this.renderer.gl,
                currentState.sourceFrame.width,
                currentState.sourceFrame.height,
                currentState.resolution
            );

            flop.setFrame(currentState.destinationFrame, currentState.sourceFrame);

            // finally lets clear the render target before drawing to it..
            flop.clear();

            let i = 0;

            for (i = 0; i < filters.length - 1; ++i)
            {
                filters[i].apply(this, flip, flop, true, currentState);

                const t = flip;

                flip = flop;
                flop = t;
            }

            filters[i].apply(this, flip, lastState.renderTarget, false, currentState);

            this.freePotRenderTarget(flip);
            this.freePotRenderTarget(flop);
        }

        filterData.index--;

        if (filterData.index === 0)
        {
            this.filterData = null;
        }
    }
/**
     * Pops off the filter and applies it.
     *
     */
Pops off the filter and applies it.
Pops off the filter and applies it .
popFilter()
    {
        const filterData = this.filterData;
        const lastState = filterData.stack[filterData.index - 1];
        const currentState = filterData.stack[filterData.index];
        this.quad.map(currentState.renderTarget.size, currentState.sourceFrame).upload();
        const filters = currentState.filters;
        if (filters.length === 1)
        {
            filters[0].apply(this, currentState.renderTarget, lastState.renderTarget, false, currentState);
            this.freePotRenderTarget(currentState.renderTarget);
        }
        else
        {
            let flip = currentState.renderTarget;
            let flop = this.getPotRenderTarget(
                this.renderer.gl,
                currentState.sourceFrame.width,
                currentState.sourceFrame.height,
                currentState.resolution
            );
            flop.setFrame(currentState.destinationFrame, currentState.sourceFrame);
            flop.clear();
            let i = 0;
            for (i = 0; i < filters.length - 1; ++i)
            {
                filters[i].apply(this, flip, flop, true, currentState);
                const t = flip;
                flip = flop;
                flop = t;
            }
            filters[i].apply(this, flip, lastState.renderTarget, false, currentState);
            this.freePotRenderTarget(flip);
            this.freePotRenderTarget(flop);
        }
        filterData.index--;
        if (filterData.index === 0)
        {
            this.filterData = null;
        }
    }
popFilter ( ) { const filterData = this . filterData ; const lastState = filterData . stack [ filterData . index - 1 ] ; const currentState = filterData . stack [ filterData . index ] ; this . quad . map ( currentState . renderTarget . size , currentState . sourceFrame ) . upload ( ) ; const filters = currentState . filters ; if ( filters . length === 1 ) { filters [ 0 ] . apply ( this , currentState . renderTarget , lastState . renderTarget , false , currentState ) ; this . freePotRenderTarget ( currentState . renderTarget ) ; } else { let flip = currentState . renderTarget ; let flop = this . getPotRenderTarget ( this . renderer . gl , currentState . sourceFrame . width , currentState . sourceFrame . height , currentState . resolution ) ; flop . setFrame ( currentState . destinationFrame , currentState . sourceFrame ) ; flop . clear ( ) ; let i = 0 ; for ( i = 0 ; i < filters . length - 1 ; ++ i ) { filters [ i ] . apply ( this , flip , flop , true , currentState ) ; const t = flip ; flip = flop ; flop = t ; } filters [ i ] . apply ( this , flip , lastState . renderTarget , false , currentState ) ; this . freePotRenderTarget ( flip ) ; this . freePotRenderTarget ( flop ) ; } filterData . index -- ; if ( filterData . index === 0 ) { this . filterData = null ; } }
Pops off the filter and applies it.
Pops off the filter and applies it .
// finally lets clear the render target before drawing to it..