-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebGL Render Warning if cacheAsBitmap is true #3767
Comments
better not use "width" and "height" , they are properties |
Is it better to use the If the |
I'm not sure that bounds won't be changed later. Its better to add flag to cached object that renderTexture is empty, or may be reference Texture.EMPTY instead, and then check it in rendering method |
Maybe I understand something wrong, but aren't the bounds used to generate the texture? https://github.com/pixijs/pixi.js/blob/dev/src/extras/cacheAsBitmap.js#L186 If either width or height are zero, the texture should be empty. So by checking width and height first, it is possible to step over lines 178 to 205 and create the sprite without texture (which will automatically use Texture.Empty https://github.com/pixijs/pixi.js/blob/dev/src/core/sprites/Sprite.js#L103) |
Referencing my previously closed #3418 issue - it's just reared it's head again, and having read this, I can confirm that the relevant container has zero children at the time. I'd turned off cacheAsBitmap previously and this must have been what resulted in a resolution. |
@ivanpopelyshev I was looking at the cacheAsBitmap implementation, and it seems bit heavy - would simply rendering to a texture do the trick? Cobbled something that sees to work, although, you need access the gl |
@neutrino84 is does rendering into the texture and it works. what's the problem? |
Fix WebGL Render Warning if cacheAsBitmap is true pixijs#3767
Sorry for the spam, I didn't know all commits would be referenced. Maybe some code makes it clearer what I think would be a good solution. Please ignore the first two commits. |
Also see this problem on Intel HD graphics card. So it is hardware related, but let`s be fair, IntelHD is world most popular built-in chip. |
Hey @jsfi, if you think you have a solution for this can you put in a PR that references this issue? Thanks! |
Whats the current update on this? I'm still getting this same bug, even on that codepen. I'm in a dilemma right now where I have to choose between setting cacheAsBitmap = false (with lower performance) or cacheAsBitmap = true (with these warnings) |
Does anyone on this thread still get this error with the latest pixi? Thanks! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
If
cacheAsBitmap
is set to true on a container that is empty or has only invisible children, Chrome (v56) and Firefox (v49) log a WebGL warning.Warning Chrome:
Warning Firefox:
Example: https://codepen.io/anon/pen/PWrXOB
Actual use-case: I have a container with n sprite elements. Depending on the state of the application I want to show 0 to n of the elements (by setting visible to true/false). After updating which sprites are visible, the container can be cached. If all elements are set to invisible the warnings appear.
My suggestion would be to extend the condition in
DisplayObject.prototype._renderCachedWebGL
(and maybe inDisplayObject.prototype._renderCachedCanvas
to be consistent) to include a check for width and height of the element.to
I can create a Pull request if you like the solution but I wanted to discuss it first as I am not sure if it's the only/best place for a fix.
The text was updated successfully, but these errors were encountered: