-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add texture coordinates to WebGL rounded rects #5795
Add texture coordinates to WebGL rounded rects #5795
Conversation
Hi @davepagurek, when I am using it, texturing doesn't seem to be working right. |
Thanks for trying it out! I have a web editor version here, does this work for you? https://editor.p5js.org/davepagurek/sketches/bMIevQinw If not, so I can try to reproduce it, what browser are you testing in? |
Yeah, thanks, this works fine for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't been following the rounded rects saga so this is all fairly new to me and all I can do is test it. It tests well. This seems like a straightforward addition to the current approach.
I think that the current approach might need further examination down the road (for the reasons you listed). Ideally, any vertex processing used to generate values for immediate mode could also be used to generate values for retained mode. What if the quadraticVertex function produced vertices based on the look-up table using a helper function so that the same helper function could be used elsewhere for caching?
Anyways! All that aside, I think this works well with the current implementation!
True good call, I imagine (but have not profiled to verify) that that'll be the majority of the time spent in this function now, so caching it would be good! |
Addresses #5001
Currently, textures only work for rounded rects in WebGL if you have
textureMode(IMAGE)
set. If you don't add border radii, then any texture mode works. This explicitly specifies texture coordinates in the WebGLrect
implementation so that it always works with provided textures regardless of mode.Changes:
Problems not addressed yet:
Screenshots of the change:
PR Checklist
npm run lint
passes