offscreenCanvas question

102 views
Skip to first unread message

Dieter Weidenbrück

unread,
Aug 28, 2023, 10:14:17 AM8/28/23
to emscripten-discuss
Hi all,
I am having problems understanding how to get the content of an offscreenCanvas to display.
Here is a sample of what I want to do:

https://github.com/dwz8/offscreentest

I want to run a pthread waiting for a trigger signal. Upon receiving that signal it should start drawing to the offscreen and display the content to the screen.
Without the pthread running the while loop everything displays fine, but somehow I need to return control to the main thread for a screen update. I have tried multiple things and am running out of ideas.
Advice is very much appreciated.

Dieter Weidenbrück (dweidenbrueck)

unread,
Sep 1, 2023, 9:34:43 AM9/1/23
to emscripten-discuss
This topic has been discussed here already, however, there was no final solution.

I have updated my sample now. I see two different behaviors:
Version 1:
- compile with -sOFFSCREENCANVAS_SUPPORT=1 and attrs.renderViaOffscreenBackBuffer = EM_FALSE
- result: no rendering on screen

Version 2:
- compile with -sOFFSCREEN_FRAMEBUFFER and attrs.renderViaOffscreenBackBuffer = EM_TRUE (no OFFSCREENCANVAS_SUPPORT)
- result: rendering on screen as expected

So, am I using OFFSCREENCANVAS_SUPPORT in a wrong way, or is support for offscreenCanvas not yet stable enough? Should I be using Framebuffer instead?

Tested on current versions of Chrome and Firefox on Windows.
Again, any advice is very much appreciated.
Reply all
Reply to author
Forward
0 new messages