BabylonJS/Babylon.js · error
_uploadArrayBufferViewToTexture not implemented.
Error message
_uploadArrayBufferViewToTexture not implemented.
What it means
NativeEngine's _uploadImageToTexture throws with the (mislabeled) message "_uploadArrayBufferViewToTexture not implemented." This is a deliberately unimplemented override: HTMLImageElement-based upload is not supported in the native runtime, where images must be handled through native APIs.
Source
Thrown at packages/dev/core/src/Engines/nativeEngine.pure.ts:51
/**
* @internal
*/
public override wrapWebGLTexture(): InternalTexture {
throw new Error("wrapWebGLTexture is not supported, use wrapNativeTexture instead.");
}
/**
* @internal
*/
public override updateWrappedWebGLTexture(): void {
throw new Error("updateWrappedWebGLTexture is not supported, use updateWrappedNativeTexture instead.");
}
/**
* @internal
*/
public override _uploadImageToTexture(texture: InternalTexture, image: HTMLImageElement, _faceIndex: number = 0, _lod: number = 0) {
throw new Error("_uploadArrayBufferViewToTexture not implemented.");
}
}
/**
* @internal
* Augments the NativeEngine type to include ThinNativeEngine methods and preventing dupplicate TS errors
*/
export interface NativeEngine extends Omit<ThinNativeEngine, keyof Engine> {}
/**
* @internal
* Applies the functionality of one or more base constructors to a derived constructor.
*/
let _Registered = false;
/**
* Register side effects for nativeEngine.
* Safe to call multiple times; only the first call has an effect.
View on GitHub (pinned to 0592b347b8)
Solutions
- On native, load textures via native image APIs (e.g. ThinNativeEngine's ArrayBuffer/binary upload paths such as _uploadArrayBufferViewToTexture once implemented, or load from file/URL handled natively).
- Convert images to raw bytes (ArrayBuffer) before upload instead of HTMLImageElement.
- Guard image-upload code paths behind a DOM-environment check when sharing code.
Example fix
// before
engine._uploadImageToTexture(texture, htmlImage, face, lod);
// after
if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement && isNativeEngine(engine)) {
throwOrConvertToBytes(image); // use native loader instead
} else {
engine._uploadImageToTexture(texture, image, face, lod);
} Defensive patterns
Strategy: validation
Validate before calling
if (typeof HTMLImageElement === "undefined" || isNativeEngine(engine)) {
// load via native loader / ArrayBuffer path instead
} Type guard
function canUploadDomImage(engine, image) {
return typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement && !("wrapNativeTexture" in engine);
} Try / catch
try {
engine._uploadImageToTexture(texture, image, face, lod);
} catch (e) {
if (/not implemented/.test(e.message)) {
loadTextureViaNativePath(texture, imageBytes);
}
} Prevention
- On native, always load textures through native image/URL loaders, not DOM images.
- Convert images to ArrayBuffer for portable upload code.
- Feature-detect DOM APIs before using image-upload paths.
When it happens
Trigger: Calling engine._uploadImageToTexture(texture, htmlImage, faceIndex, lod) on NativeEngine — e.g. via texture.updateURL / loadFromImage paths that assume a browser DOM image.
Common situations: Porting web code to Babylon Native and using DOM Image uploads; react-native code passing an HTMLImageElement (which the native runtime never produces).
Related errors
- wrapWebGLTexture is not supported, use wrapNativeTexture ins
- updateWrappedWebGLTexture is not supported, use updateWrappe
- updateWrappedWebGLTexture: wrapped texture's render-target w
- ${extensionContext}: Texture type not supported
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/0543bede555fdf98.
Report an issue: GitHub.