44
55function _CreateEmptyTexture ( gl , width , height , scaleMode ) {
66 var texture = gl . createTexture ( ) ;
7- gl . activeTexture ( gl . TEXTURE0 ) ;
87 gl . bindTexture ( gl . TEXTURE_2D , texture ) ;
98 gl . texParameteri ( gl . TEXTURE_2D , gl . TEXTURE_WRAP_S , gl . CLAMP_TO_EDGE ) ;
109 gl . texParameteri ( gl . TEXTURE_2D , gl . TEXTURE_WRAP_T , gl . CLAMP_TO_EDGE ) ;
@@ -21,12 +20,13 @@ var _fbErrors = {
2120 36061 : 'Framebuffer unsupported'
2221} ;
2322
24- function _CreateFramebuffer ( gl , width , height , scaleMode ) {
23+ function _CreateFramebuffer ( gl , width , height , scaleMode , textureUnit ) {
2524 var framebuffer = gl . createFramebuffer ( ) ;
2625 var depthStencilBuffer = gl . createRenderbuffer ( ) ;
2726 var colorBuffer = null ;
2827 var fbStatus = 0 ;
2928
29+ gl . activeTexture ( gl . TEXTURE0 + textureUnit ) ;
3030 gl . bindFramebuffer ( gl . FRAMEBUFFER , framebuffer ) ;
3131 gl . bindRenderbuffer ( gl . RENDERBUFFER , depthStencilBuffer ) ;
3232 gl . framebufferRenderbuffer ( gl . FRAMEBUFFER , gl . DEPTH_STENCIL_ATTACHMENT , gl . RENDERBUFFER , this . renderBuffer ) ;
@@ -55,7 +55,7 @@ function _CreateFramebuffer(gl, width, height, scaleMode) {
5555* @param height {Number} the vertical range of the filter
5656* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
5757*/
58- PIXI . FilterTexture = function ( gl , width , height , scaleMode )
58+ PIXI . FilterTexture = function ( gl , width , height , scaleMode , textureUnit )
5959{
6060 /**
6161 * @property gl
@@ -69,43 +69,15 @@ PIXI.FilterTexture = function(gl, width, height, scaleMode)
6969 * @property frameBuffer
7070 * @type Any
7171 */
72- this . frameBuffer = _CreateFramebuffer ( gl , width , height , scaleMode || PIXI . scaleModes . DEFAULT ) ;
72+ this . frameBuffer = _CreateFramebuffer ( gl , width , height , scaleMode || PIXI . scaleModes . DEFAULT , textureUnit ) ;
73+ /**
74+ * @property texture
75+ * @type Any
76+ */
7377 this . texture = this . frameBuffer . targetTexture ;
7478 this . width = width ;
7579 this . height = height ;
7680 this . renderBuffer = this . frameBuffer . renderBuffer ;
77- /* this.frameBuffer = gl.createFramebuffer();
78-
79- / **
80- * @property texture
81- * @type Any
82- * /
83- //this.texture = gl.createTexture();
84-
85- / **
86- * @property scaleMode
87- * @type Number
88- * /
89- scaleMode = scaleMode || PIXI.scaleModes.DEFAULT;
90-
91- this.destTexture = gl.createTexture();
92- gl.activeTexture(gl.TEXTURE0);
93-
94- gl.bindTexture(gl.TEXTURE_2D, this.destTexture);
95- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, scaleMode === PIXI.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST);
96- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, scaleMode === PIXI.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST);
97- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
98- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
99-
100- gl.bindFramebuffer(gl.FRAMEBUFFER, this.frameBuffer );
101- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.destTexture, 0);
102-
103- // required for masking a mask??
104- this.renderBuffer = gl.createRenderbuffer();
105- gl.bindRenderbuffer(gl.RENDERBUFFER, this.renderBuffer);
106- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.renderBuffer);
107-
108- this.resize(width, height);*/
10981} ;
11082
11183PIXI . FilterTexture . prototype . constructor = PIXI . FilterTexture ;
0 commit comments