-
Notifications
You must be signed in to change notification settings - Fork 906
Refactor using of stencil clipping in WebGL render #3250
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
Conversation
-remove calling of where heavy function gl.GetParameter -clear depth & stencil buffer by gl.clear -use stencil g.REPLACE on before draw stencil
|
Thank you ! I will test it with more mobile devices. |
|
@1scaR1 Thanks. My proposal is that we can replace For |
|
@dabingnn, So, in my opinion, there are two ways to solve this: 1.Warn users about using of gl stencil functions in clipping nodes What do you think about it? |
|
Thank you guys for your feedbacks. A small note, in Cocos2d-html5, we have never encourage user to use gl functions, our rendering process is not so flexible, unfortunately. |
|
@pandamicro Let's confirm if we allow user to do this:
this solution will not works well.
@1scaR1 I did not get your idea, did you mean wrap those |
|
@dabingnn, I offer to add functions to |
I think user can manage it when they extend our rendering process, adding two more APIs doesn't mean they will know how to use. I will merge this PR because the performance can benefit a lot from it, and clipping node is especially useful in UI system. As the rendering process isn't in the official API set, the ability of extending it may suffer a little, but I think it worth. Thank you for your contribution. @1scaR1 |
|
@1scaR1 I found an issue of multiple layout usage, my scene looks like this. So the problem is that layouts are also clipping contents in previous layouts |
|
I think , I,be fixed it in #3260. Issue was with restoring of clipping state after drawing of layout |
|
Yes, sorry, I was using a branch not fully updated |

This patch improves performance of stencil clipping in web GL Render. It passes all clipping tests.
Here performance compare in scene with ccui.ScrollView and 5 ccui.Layouts with clipping enabled in it(In Google Chrome browser, Core i7 Processor, GeForce 750M graphics):