Jump to content

Gradient Resource with CanvasRenderer?


arvnik
 Share

Recommended Posts

Hi!

I'm currently working on a project where I need a resizable gradient texture to apply as a background to one of my sprites. I've been following the example for how to create a Gradient Resource from the documentation (https://pixijs.io/examples/#/textures/gradient-resource.js), which is working fine as long as I have WebGL enabled. When using the CanvasRenderer, however, the sprite renders without any background. This seems to be due to the upload method never getting called from CanvasRenderer.render but even if I call it explicitly it just breaks (since the gl propery isn't available on CanvasRenderer). Is there a way to achieve the same using the CanvasRenderer? I've been fiddling around with renderer.plugins.prepare in order to somehow do the upload manually but can't quite get it working. Does anyone have any experience with this? What am I missing here? :)

Link to comment
Share on other sites

At the moment we dont have fallbacks for texture resources + CanvasRenderer. Why? Because no one implemented it. First we need alternative method that wont call "texImage2d", and second - a place where this upload will actually happen, there's no such place in CanvasRenderer.  

Another example in the same group should work for you.

Link to comment
Share on other sites

22 hours ago, ivan.popelyshev said:

At the moment we dont have fallbacks for texture resources + CanvasRenderer. Why? Because no one implemented it. First we need alternative method that wont call "texImage2d", and second - a place where this upload will actually happen, there's no such place in CanvasRenderer.  

Another example in the same group should work for you.

OK, got it. After some tweaking I got the Gradient Basic example working for my scenario. Thanks!

Link to comment
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...
 Share

  • Recently Browsing   0 members

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