浏览代码

Merge pull request #7870 from sebavan/master

Fix video texture upload
David Catuhe 5 年之前
父节点
当前提交
c16dcb8f49
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/Engines/Extensions/engine.videoTexture.ts

+ 4 - 0
src/Engines/Extensions/engine.videoTexture.ts

@@ -26,6 +26,9 @@ ThinEngine.prototype.updateVideoTexture = function(texture: Nullable<InternalTex
     try {
         // Testing video texture support
         if (this._videoTextureSupported === undefined) {
+            // clear old errors just in case.
+            this._gl.getError();
+
             this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, video);
 
             if (this._gl.getError() !== 0) {
@@ -50,6 +53,7 @@ ThinEngine.prototype.updateVideoTexture = function(texture: Nullable<InternalTex
                 texture._workingCanvas.height = texture.height;
             }
 
+            texture._workingContext!.clearRect(0, 0, texture.width, texture.height);
             texture._workingContext!.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, texture.width, texture.height);
 
             this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, texture._workingCanvas);