Closed vorg closed 3 months ago
I'd say yes, warning in pex-context but also overwrite supportImageBitmap by checking isWebGL2 in pex-renderer.
Why do we not support in in gltf in Safari?
From https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap
Btw FF gives better error in WebGL1 WebGLRenderingContext.texImage2D: Argument 9 does not implement interface ArrayBufferViewOrNull.
Possible fix here https://stackoverflow.com/questions/42073596/webglrenderingcontext-teximage2d-does-not-implement-interface-arraybuffervieworn
Hmm if i do this in WebGL1 then it works.. does it mean ImageBitmap is considered HTMLElement in WebGL1 and ArrayBuffer view compatible in WebGL2 only?
Why do we not support in in gltf in Safari?
Because it doesn't support options.colorSpaceConversion
which is GLTF spec: https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap#browser_compatibility
FF >= 98 supports it so I didn't added a check for it.
Proposed change: check if ImageBitmap in webgl.
}
const img = opts.data ? opts.data : opts;
- if (img && img.nodeName) {
+ if (
+ (img && img.nodeName) ||
+ (!ctx.capabilities.isWebGL2 && img instanceof ImageBitmap)
+ ) {
Looks good to me
As per https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D
Should we warn in pex-context or rely on browser to fail? Is creates issue here https://github.com/pex-gl/pex-renderer/blob/v4/loaders/glTF.js#L1234