Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Sprite from buffer


ephraimt
 Share

Recommended Posts

I am trying to display an image that I get in the form of Uint8Array.

/*
width: 640,
height: 360,
data: Uint8Array(921600) [
     89,  72, 34, 255,  97,  80, 42, 255, 105,  93, 43, 255,
    117, 105, 55, 255, 117, 106, 49, 255, 110,  99, 42, 255,
    111,  98, 31, 255, 111,  98, 31, 255, 115, 107, 22, 255,
    117, 109, 24, 255, 119, 115, 16, 255, 117, 113, 14, 255,
    127, 121, 13, 255, 131, 125, 17, 255, 144, 126, 30, 255,
    146, 128, 32, 255, 143, 131, 35, 255, 135, 123, 27, 255,
    130, 112, 26, 255, 127, 109, 23, 255, 129, 103, 32, 255,
    126, 100, 29, 255, 125,  94, 28, 255, 123,  92, 26, 255,
    121,  80, 20, 255,
    ... 921500 more items
*/

const imageTexture = PIXI.Texture.fromBuffer(data, width, height);
const sprite = PIXI.Sprite(imageTexture);

Is there something else I have to do so that the Sprite displays the Texture?

If I create imageTexture using PIXI.Loader, then it works.

Link to comment
Share on other sites

Oh, right, fromBuffer() doesnt work with canvas2d. Whole TextureResource subsystem werent coded for it yet, because no one needed that. Now that you've asked for it , we can have that in two months or so, because it requires to code whole system for canvas and not just one "fromBuffer", and most of the team is busy.

Edited by ivan.popelyshev
Link to comment
Share on other sites

  • 5 months later...
  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...