|
@@ -282,7 +282,12 @@ class WebGLBackend extends Backend {
|
|
|
textureUtils.setTextureParameters( glTextureType, texture );
|
|
|
|
|
|
gl.bindTexture( glTextureType, textureGPU );
|
|
|
- gl.texStorage2D( glTextureType, levels, glInternalFormat, width, height );
|
|
|
+
|
|
|
+ if ( ! texture.isVideoTexture ) {
|
|
|
+
|
|
|
+ gl.texStorage2D( glTextureType, levels, glInternalFormat, width, height );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
this.set( texture, {
|
|
|
textureGPU,
|
|
@@ -298,7 +303,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
const { gl } = this;
|
|
|
const { width, height } = options;
|
|
|
- const { textureGPU, glTextureType, glFormat, glType } = this.get( texture );
|
|
|
+ const { textureGPU, glTextureType, glFormat, glType, glInternalFormat } = this.get( texture );
|
|
|
|
|
|
const getImage = ( source ) => {
|
|
|
|
|
@@ -306,9 +311,13 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
return source.image.data;
|
|
|
|
|
|
+ } else if ( source instanceof ImageBitmap || source instanceof OffscreenCanvas ) {
|
|
|
+
|
|
|
+ return source;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- return source;
|
|
|
+ return source.data;
|
|
|
|
|
|
};
|
|
|
|
|
@@ -326,6 +335,13 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ } else if ( texture.isVideoTexture ) {
|
|
|
+
|
|
|
+ texture.update();
|
|
|
+
|
|
|
+ gl.texImage2D( glTextureType, 0, glInternalFormat, glFormat, glType, options.image );
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
const image = getImage( options.image );
|