-
-
Notifications
You must be signed in to change notification settings - Fork 642
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 a me.Path2D API for better abstraction between Canvas and WebGL #648
Comments
Reminder: We don't have |
Oh that's a good point, hmmm. |
We will need an equivalent of the Canvas Path API to support all of the fill operations in WebGL. At the moment we can only fill rectangles using the quad shader. |
moving to 3.0.0, looks like too many changes to have this ready for 2.2.0 |
looking at this old ticket, we already have some but to make it generic, i would rather keep only the generic and then mimic the canvas API by adding a note: Flash defines a that would give the following semantic : renderer.beginFill(0x333333);
renderer.beginStroke(0xFFFFFF);
renderer.drawShape(myShape);
renderer.endFill(); // optional if subsequent shapes should use the same
renderer.endStroke(); // optional if subsequent shapes should use the same |
That Flash API doesn't feel much like Canvas. What we really need to do is polyfill the Path2D API: https://developer.mozilla.org/en-US/docs/Web/API/Path2D (and implement it directly for WebGL) as a replacement for custom stuff like |
oh, i like that idea even better ! |
drawShape
- ellipse drawing is approximative and aliased, proper way to get a clean circle is probably through a shader - also optimized/prevented buffer allocation when drawing shapes in WebGL (by passing the _glPoints (former _linePoints) array and the actual "used" len to the drawLine method)
both renderer now support stroke and fill operations for all me.Shape objects, what we need now is a path2d implementation to provide one more layer of abstraction when drawing these shapes and move away drawing code from both corresponding renderer. |
drawShape
melonJS/src/video/canvas/canvas_renderer.js
Line 454 in 939428e
This method uses stroke calls. It should be an option to do stroke or fill.
The text was updated successfully, but these errors were encountered: