Skip to content

Commit

Permalink
Fix for video textures (#5836)
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck authored Nov 21, 2023
1 parent eeeb37b commit 6a2b88a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/platform/graphics/webgl/webgl-texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,13 @@ class WebglTexture {
}
}

const w = mipObject.width || mipObject.videoWidth;
const h = mipObject.height || mipObject.videoHeight;

// Upload the image, canvas or video
device.setUnpackFlipY(texture._flipY);
device.setUnpackPremultiplyAlpha(texture._premultiplyAlpha);
if (this._glCreated && mipObject.width === texture._width && mipObject.height === texture._height) {
if (this._glCreated && texture._width === w && texture._height === h) {
gl.texSubImage2D(
gl.TEXTURE_2D,
mipLevel,
Expand All @@ -533,6 +536,11 @@ class WebglTexture {
this._glPixelType,
mipObject
);

if (mipLevel === 0) {
texture._width = w;
texture._height = h;
}
}
} else {
// Upload the byte array
Expand Down

0 comments on commit 6a2b88a

Please sign in to comment.