Skip to content

textImage2D does not accept OffscreenCanvas anymore as a pixel source for texture #1180

Open
@obiot

Description

Describe the bug
Since the last macOS and Safari version, textImage2D does not accept OffscreenCanvas anymore as a pixel source for texture. Passing directly a OffscreenCanvas element will throw a Type Error exception.

Device:

  • OS: macOS 13.3
  • Browser: Safari 16.4
  • melonJS Version: 14.0 and higher

Solution
This was fixed in the 15.1 release by using transfertToBitmapImage() when the pixels source is an Offscreen Canvas.

Unfortunately, that led to another issue when using Offscreencanvas and system font rendering in WebGL, with the converted BitmapImage producing some garbaged pixel soup :
Screenshot 2023-03-30 at 10 28 13 AM

Internal use of OffscreenCanvas when rendering text was then also disabled in the same fix, to restore the previous behaviour :
Screenshot 2023-03-30 at 10 28 41 AM

In conclusion, the issue is fixed for now, but I'm creating this issue, because I'm not sure if this is actually the expected behaviour as per the W3C/WebGL standard or a bug with the current version of Safari (other browsers are still fine with using OffscreenCanvas as a pixel source).

If anyone has any additional insight on this, I'm definitely interested !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions