WebGL and Synchronous Fetching (--proxy-to-worker)

36 views
Skip to first unread message

Magicalbat

unread,
Feb 6, 2023, 10:54:28 PM2/6/23
to emscripten-discuss
Hello,

I am new to emscripten and I have been trying to port some of my code to work with WebGL. After some difficulty, I had a file loading function working with a synchronous fetch that required the "--proxy-to-worker" compiler flag. Next, I tried to get WebGL to work, but I was not able to make a context. I would get this error: "Uncaught TypeError: Module.canvas.getContext is not a function at Worker.worker_onmessage". I only get this error when compiling with the proxy flag. Is there a way to get a WebGL context with this flag? Thanks.

Magicalbat

unread,
Feb 7, 2023, 2:26:42 PM2/7/23
to emscripten-discuss
I did some looking, and it seems that you cannot interact with the dom from a web worker. Is there a way to get around this, or is there a way to do a synchronous fetch without a worker?

Александр Гурьянов

unread,
Feb 7, 2023, 2:45:08 PM2/7/23
to emscripte...@googlegroups.com
You can use asyncify to do synchronous fetch

Вт, 7 февр. 2023 г. в 22:26, Magicalbat <magic...@comcast.net>:
--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/bbbf53c7-51a2-4e41-904c-cd88e935a9f6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages