Sign in to follow this  
NoleDjok

Pixi.js Sprite from doesn`t work correctly WebGL

Recommended Posts

There is a function where I draw lines on htmlcanvas. After drawing I create Pixi.Sprite from this canvas. On Canvas renderer everything

works OK, but when I swich on WebGl something goes wrong. Only first line is drawn.
 

function.png

dosentDraw.png

Share this post


Link to post
Share on other sites

you should update texture every time it is changed. Im not sure from() does it.

Manually create it one time:

var tex = Texture.from(myCanvas);

you can use sprites with that texture.

now, every time you change something on that canvas, you should do "tex.update()"

Edited by ivan.popelyshev

Share this post


Link to post
Share on other sites

My advice - you should clone pixijs repo to your computer, open in separate IDE window and watch inside whatever methods/classes you are using. from() method is very general thing that is ok to use without knowing what it does in demos. In production - you have to be sure.

Btw, usually people use Rope with texture (maybe with transparent edge) instead of canvas lines.

Share this post


Link to post
Share on other sites
22 hours ago, ivan.popelyshev said:

you should update texture every time it is changed. Im not sure from() does it.

Manually create it one time:


var tex = Texture.from(myCanvas);

you can use sprites with that texture.

now, every time you change something on that canvas, you should do "tex.update()"

Thanks for respond. It turned up helpful. I will learn about Rope with texture. It`s interesting.

Share this post


Link to post
Share on other sites

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.