88var Class = require ( '../../utils/Class' ) ;
99var CONST = require ( '../../const' ) ;
1010var IsSizePowerOfTwo = require ( '../../math/pow2/IsSizePowerOfTwo' ) ;
11+ var SpliceOne = require ( '../../utils/array/SpliceOne' ) ;
1112var Utils = require ( './Utils' ) ;
1213var WebGLSnapshot = require ( '../snapshot/WebGLSnapshot' ) ;
1314
@@ -1297,6 +1298,13 @@ var WebGLRenderer = new Class({
12971298 */
12981299 deleteTexture : function ( texture )
12991300 {
1301+ var index = this . nativeTextures . indexOf ( texture ) ;
1302+
1303+ if ( index !== - 1 )
1304+ {
1305+ SpliceOne ( this . nativeTextures , index ) ;
1306+ }
1307+
13001308 this . gl . deleteTexture ( texture ) ;
13011309
13021310 return this ;
@@ -1555,9 +1563,7 @@ var WebGLRenderer = new Class({
15551563 * @since 3.0.0
15561564 *
15571565 * @param {HTMLCanvasElement } srcCanvas - [description]
1558- * @param {WebGLTexture } dstTexture - [description]
1559- * @param {boolean } shouldReallocate - [description]
1560- * @param {integer } scaleMode - [description]
1566+ * @param {WebGLTexture } [dstTexture] - [description]
15611567 *
15621568 * @return {WebGLTexture } [description]
15631569 */
@@ -1580,16 +1586,10 @@ var WebGLRenderer = new Class({
15801586 {
15811587 this . setTexture2D ( dstTexture , 0 ) ;
15821588
1583- // if (!shouldReallocate && dstTexture.width >= srcCanvas.width || dstTexture.height >= srcCanvas.height)
1584- // {
1585- // gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, srcCanvas.width, srcCanvas.height, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas);
1586- // }
1587- // else
1588- {
1589- gl . texImage2D ( gl . TEXTURE_2D , 0 , gl . RGBA , gl . RGBA , gl . UNSIGNED_BYTE , srcCanvas ) ;
1590- dstTexture . width = srcCanvas . width ;
1591- dstTexture . height = srcCanvas . height ;
1592- }
1589+ gl . texImage2D ( gl . TEXTURE_2D , 0 , gl . RGBA , gl . RGBA , gl . UNSIGNED_BYTE , srcCanvas ) ;
1590+
1591+ dstTexture . width = srcCanvas . width ;
1592+ dstTexture . height = srcCanvas . height ;
15931593
15941594 this . setTexture2D ( null , 0 ) ;
15951595 }
0 commit comments