gl.texImage2DがUint8ClampedArrayを受け付けない

%3CLINGO-SUB%20id%3D%22lingo-sub-1483120%22%20slang%3D%22ja-JP%22%3Egl.texImage2D%20does%20not%20accept%20Uint8CampedArray%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1483120%22%20slang%3D%22ja-JP%22%3E%3CP%3EEnvironment%3A%20Edge%2F18.18363%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20you%20pass%20uint8CampedArray%20to%20texImage2D%20in%20WebGL%20context%2C%20%22WEBGL11068%3A%20INVALID_OPERATION%3A%20texImage2D%3A%20Typed%20array%20type%20and%20pixel%20data%20type%20must%20match%22%20is%20output%20to%20the%20console.%3C%2FP%3E%3CP%3EAt%20this%20time%2C%20if%20the%20data%20is%20passed%20as%20Uint8Array%20in%20the%20same%20way%2C%20drawing%20is%20successful.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUint8CampedArray%20is%20a%20type%20of%20ImageData.data%20obtained%20by%20getImageData%20from%20the%202D%20context%20of%20canvas%2C%20and%20this%20phenomenon%20occurred%20when%20using%20images%20generated%20by%20canvas%20as%20WebGL%20textures.%3C%2FP%3E%3CP%3EChrome%2C%20Firefox%20is%20drawing%20without%20problems%20even%20if%20you%20pass%20the%20Uint8CampedArray%2C%20currently%20only%20Edge%20needs%20to%20copy%20the%20data%20to%20Uint8Array.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493000%22%20slang%3D%22en-US%22%3ERe%3A%20gl.texImage2D%E3%81%8CUint8ClampedArray%E3%82%92%E5%8F%97%E3%81%91%E4%BB%98%E3%81%91%E3%81%AA%E3%81%84%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493000%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F707571%22%20target%3D%22_blank%22%3E%40tail-feather%3C%2FA%3E%26nbsp%3BWelcome%20to%20our%20MSFT%20Edge%20Insider%20community%2C%20and%20thanks%20for%20reaching%20out.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20mentioned%20that%20this%20works%20as%20expected%20in%20Chrome%3B%20can%20you%20please%20confirm%20which%20version%20you%20tested%20it%20on%3F%20And%20similarly%2C%20which%20channel%20and%20version%20of%20Microsoft%20Edge%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CI%3EFawkes%20(they%2Fthem)%3CBR%20%2F%3E%3CBR%20%2F%3EProject%20%26amp%3B%20Community%20Manager%20-%20Microsoft%20Edge%3CI%3E%3C%2FI%3E%3C%2FI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

発生環境:Edge/18.18363

 

WebGLコンテキストでtexImage2DにUint8ClampedArrayを渡すと「WEBGL11068: INVALID_OPERATION: texImage2D: 型指定された配列の型とピクセルデータの型は一致させる必要があります」とコンソールに出力されます。

この時、同様の処理でデータをUint8Arrayとして渡せば正常に描画が行われます。

 

Uint8ClampedArrayはcanvasの2DコンテキストからgetImageDataで取得したImageData.dataの型であり、本現象はcanvasで生成した画像をWebGLのテクスチャとして使用する際に発生しました。

Chrome, FirefoxではUint8ClampedArrayを渡しても問題なく描画が行われており、現状EdgeのみUint8Arrayにデータをコピーする必要があります。

 

1 Reply
Highlighted

@tail-feather Welcome to our MSFT Edge Insider community, and thanks for reaching out.

 

You mentioned that this works as expected in Chrome; can you please confirm which version you tested it on? And similarly, which channel and version of Microsoft Edge?

 

Fawkes (they/them)
Project & Community Manager - Microsoft Edge