@@ -95,8 +95,8 @@ class Texture {
9595 if ( this . size ) {
9696 if ( externalImage ) {
9797 gl . texSubImage2D ( gl . TEXTURE_2D , 0 , x , y , _getLegacyFormat ( this . format ) , _getType ( this . format ) , image ) ;
98- } else {
99- gl . texSubImage2D ( gl . TEXTURE_2D , 0 , x , y , srcWidth , srcHeight , _getLegacyFormat ( this . format ) , _getType ( this . format ) , ( image as RGBAImage | AlphaImage | Float32Image | EmptyImage ) . data ) ;
98+ } else if ( 'data' in image && image . data ) {
99+ gl . texSubImage2D ( gl . TEXTURE_2D , 0 , x , y , srcWidth , srcHeight , _getLegacyFormat ( this . format ) , _getType ( this . format ) , image . data ) ;
100100 }
101101 }
102102
@@ -200,7 +200,9 @@ export class Texture3D {
200200 assert ( image . height === height ) ;
201201 assert ( image . width === width * depth ) ;
202202
203- gl . texImage3D ( gl . TEXTURE_3D , 0 , this . format , width , height , depth , 0 , _getLegacyFormat ( this . format ) , _getType ( this . format ) , ( image as RGBAImage | AlphaImage | Float32Image | EmptyImage ) . data ) ;
203+ if ( 'data' in image && image . data ) {
204+ gl . texImage3D ( gl . TEXTURE_3D , 0 , this . format , width , height , depth , 0 , _getLegacyFormat ( this . format ) , _getType ( this . format ) , image . data ) ;
205+ }
204206 }
205207
206208 bind ( filter : TextureFilter , wrap : TextureWrap ) {
0 commit comments