Hi
When using Emscripten to create .js code it will use if (GL.currentContext.version >= 2)
in many places in the produced code ( works in standalone .js and .wasm websites when the Emscripten creates all the .html files )
But when i use this .js with PlayCanvas All browsers hangs with error
TypeError: Cannot read properties of undefined (reading ‘version’)
Why there is no GL.currentContext.version defined with PlayCanvas ?
( I used some 2 years old Emscripten previously which does not create these version checks and everything works perfectly )
Code snipped from Emscripten generated .js file:
function _glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels) {
if (GL.currentContext.version >= 2) {
// WebGL 2 provides new garbage-free entry points to call to WebGL. Use those always when possible.
if (GLctx.currentPixelUnpackBufferBinding) {
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
} else if (pixels) {
var heap = heapObjectForWebGLType(type);
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, heap, pixels >> heapAccessShiftForWebGLHeap(heap));
} else {
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, null);
}
return;
}
GLctx.texImage2D(target, level, internalFormat, width, height, border, format, type, pixels ? emscriptenWebGLGetTexPixelData(type, format, width, height, pixels, internalFormat) : null);
}
This does not work with PlayCanvas but works with anything else. What is the catch here?
Thanks