Current solution is little bit ugly. For example class HTMLElement {}
line is needed to work in stable version but it will be a bit confusing for documentation.
I was wondering, could we have offscreen canvas using worker-threads of nodeJS?
nodeJS does not support offscreen canvas
Thanks, following the doc then
Another question about this great feature.
If we have several canvas on one page, does that mean that each canvas will have its own worker and thus its own thread?
If you use offscreen canvas: yes
Wow
I noticed that the function
Engine.isSupported();
does not work properly inside a worker.
Based on @kyptov awesome work, I build a typescript version and added stuff.
You can check it here: naker-services/Viewer at Adding_offscreenCanvas · nakerwave/naker-services · GitHub
screen and worker are the two classes making the connection.
As you requested @Deltakosh I guess a link to these files would be great in the documentation?
This is not possible to not have webGL if offscreen canvas is supported
We tested this feature on mobile.
And we get this message with an iphone
So I guess offscreencanvas are not yet available on some smartphone?
Plus I use that test which I found in your demo page @Deltakosh
if (‘OffscreenCanvas’ in window)
to make sure I can use offscreen canvas but again this test doesn’t work on mobile
From the bug above I guess we should also test ?
if (‘transferControlToOffsceen’ in canvas)
If right, I would add that to the documentation. Pretty sure a lot of people will have that issue too!
It depends on the phone:) some supports a partial version of the offscreen canvas so yeah you can definitely update the doc
Hi. I saw you added use of ImageBitmap instead of Image class in a worker, but there is an issue. According to the WebGl spec
UNPACK_FLIP_Y_WEBGL, UNPACK_PREMULTIPLY_ALPHA_WEBGL , UNPACK_COLORSPACE_CONVERSION_WEBGL …
If the TexImageSource is an ImageBitmap, then these three parameters will be ignored. Instead the equivalent ImageBitmapOptions should be used to create an ImageBitmap with the desired format.
invertY has default true in Texture constructor and it cause that some ImageBitmap a flipped.
https://www.babylonjs-playground.com/#08GVKY#8 (to restore Image class its need to reload page)
Yes this is a very good point!
We have no choice but using ImageBitmap. Then you are forced to not use invertY and instead either:
- invert source image
- use texture.vScale with -1