bp74 / StageXL

A fast and universal 2D rendering engine for HTML5 and Dart.
http://www.stagexl.org
Other
880 stars 82 forks source link

StageXL should use createImageBitmap and ImageBitmap where supported #351

Closed mnordine closed 2 years ago

mnordine commented 2 years ago

Loading images via an ImageElement, when you're only going to upload as a WebGL texture, is wasteful.

The most efficient way is to use createImageBitmap() and ImageBitmap, where an image is loaded via xhr, and uploading to the GPU without a copy.

See https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap and https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap