question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow ImageBitmap as texture source

See original GitHub issue

ImageBitmap is now available in both Chrome and Firefox, and is a far faster, and better texture source than Image or Canvas elements:

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

Right now we have hacked the BaseTexture.loadSource function to detect a passed in ImageBitmap and fire _sourceLoaded(); immediately. This works perfectly, uploading large textures to the GPU is now pretty much instantaneous.

We are simply detecting a passed in ImageBitmap like so:

if(this.source.close){
      console.log('Texture source is an ImageBitmap');
      this._sourceLoaded();
} 
else if {
    //check for other types of Texture sources
}

These ImageBitmaps can be entirely released from memory when they are no longer needed by calling ImageBitmap.close() where supported. As such, they do not require garbage collection and therefore give the developer far better control, as well as improved performance.

Please consider adding support into PIXI.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
englercjcommented, Jun 1, 2017

Textures from ImageBitmap are supported in v5, and it also converts all images into ImageBitmap’s internally.

1reaction
GoodBoyDigitalcommented, Apr 13, 2017

this is getting me all excited! Lets definitely look into making it part of the load prep process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow ImageBitmap as texture source · Issue #3930 · pixijs/pixijs
I believe that createImageBitmap spawns a parallel CPU thread so that the decoding and processing all happens in the background, meaning that it ......
Read more >
1187812 - [Foxeye] Let WebGL::TexImageSource accept ...
This bug is to let TexImage2D accept a BitmapImage as source object. Before this change, to draw a BitmapImage into a 3D canvas,...
Read more >
How to load images in the background with no jank
In our WebGL application I'm trying to load and decode texture images in a ... you can't give ImageBitmap enough info to tell...
Read more >
Loading an image using the Fetch API for use with WebGL
texImage2D() documentation says that I can use ImageBitmap as source. Updated. I tried to use the loadImage function from this answer: https:// ...
Read more >
ImageBitmap & Texture.from memory leak :( - Pixi.js
It allows to store and upload whatever you need. Again, you have to know how TextureSystem works to do it. You can try...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found