BabylonJS/Babylon.js · error
updateWrappedWebGLTexture is not supported, use updateWrappe
Error message
updateWrappedWebGLTexture is not supported, use updateWrappedNativeTexture instead.
What it means
NativeEngine cannot update a texture wrapped from WebGL handles because no WebGL texture exists in the native runtime. updateWrappedWebGLTexture() is intentionally stubbed to throw; the native counterpart is updateWrappedNativeTexture().
Source
Thrown at packages/dev/core/src/Engines/nativeEngine.pure.ts:44
*/
public constructor(options: NativeEngineOptions = {}) {
super(null, false, undefined, options.adaptToDeviceRatio);
this._initializeNativeEngine(options.adaptToDeviceRatio ?? false);
}
/**
* @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
View on GitHub (pinned to 0592b347b8)
Solutions
- Use updateWrappedNativeTexture() when running on NativeEngine.
- Guard the call behind a platform check (wrapNativeTexture presence) and call the matching native API.
- Skip the update entirely on native if the underlying native texture handle is unchanged.
Example fix
// before
engine.updateWrappedWebGLTexture(internalTex);
// after
if ((engine as any).updateWrappedNativeTexture) {
(engine as any).updateWrappedNativeTexture(internalTex);
} else {
engine.updateWrappedWebGLTexture(internalTex);
} Defensive patterns
Strategy: type-guard
Validate before calling
if ("updateWrappedNativeTexture" in engine) {
(engine as any).updateWrappedNativeTexture(tex);
} else {
engine.updateWrappedWebGLTexture(tex);
} Type guard
function supportsNativeWrap(e) {
return "updateWrappedNativeTexture" in e;
} Try / catch
try {
engine.updateWrappedWebGLTexture(tex);
} catch (e) {
if (/updateWrappedNativeTexture/.test(e.message)) {
(engine as any).updateWrappedNativeTexture(tex);
}
} Prevention
- Pair wrap/update calls with their platform-correct variants.
- Add a compile-time abstraction (interface with both methods) so TS flags misuse.
- Run cross-platform smoke tests for texture lifecycle.
When it happens
Trigger: Calling engine.updateWrappedWebGLTexture(texture) on a NativeEngine, typically from shared code that refreshes a wrapped texture's contents after context restore or dynamic update.
Common situations: Cross-platform code (web + Babylon Native) hitting the WebGL refresh path on native builds; context-restore recovery logic that has no meaning on native.
Related errors
- wrapWebGLTexture is not supported, use wrapNativeTexture ins
- _uploadArrayBufferViewToTexture not implemented.
- 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/dc99dd7f57d1ae2b.
Report an issue: GitHub.