-
Notifications
You must be signed in to change notification settings - Fork 177
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
2d canvas / webgl #67
Comments
Since the structure is built on an immediate mode metaphor, and renderers are just functions, it should be possible to build on the react/svg work to move to a canvas/webgl game engine when speed or aesthetics makes it attractive:
The main thing to test in canvas/webgl engines is if their hit-testing can differentiate overlapping curves. When I checked at least pixi could only hit-test rectangles and ellipses. Paper.js looks like the winner for our use case. 🍎 |
They slipped hit-testing into the standard canvas 2d when I wasn't looking, but it isn't implemented yet This hack might work for 2d: https://shifteleven.com/articles/2012/01/08/mouse-clicks-for-html5-cavas-entities-via-paths/ |
The trick I've seen used with canvas is to draw the same objects with a solid aliased color into a separate canvas. Then when you click, get the pixel color on the hidden canvas and match it up to the real object using a lookup table of pixel color keys to real object values. Not sure if that's the same technique that shift eleven is using or not. |
Looks like a different technique, but seems cleaner, and faster. As long as we have < 16777216 edges 😉 Shift Eleven is keeping track of all paths and then writing them in reverse order on every click. With 10000 objects you start to notice. 💡 Thanks! |
idea While animating (zoom, pan, drag node) switch to a 2d canvas view for 60fps goodness. Then release to rerender SVG. Then we still get the text and click advantages of SVG. A simplified canvas renderer wouldn't need all the bells and whistles. Just general shapes and colors, a little more than the-graph-thumb. Canvas' Would need tests to see how jarring switching between would be. |
Maybe always render using canvas with SVG layered on top for text and noodles. Then hide the SVG while zooming and panning. |
WebGL implementation of SVG, focused on d3: http://pathgl.com/ (Missing text and curves, which is most of what we have. And there is still no WebGL on iOS.) |
Pixi/webgl drawing of force-directed graphs https://github.com/anvaka/ngraph/tree/master/examples/pixi.js Bezier demo: http://jabtunes.com/labs/3d/bezierlights/ |
MathBox2 looks almost ludicrously fantastic: http://acko.net/files/pres/siggraph-2014-bof/online.html |
iOS 8 has WebGL enabled for Safari and WebViews by default! |
|
Yeah, I emailed with @unconed about making a flowhub runtime for ShaderGraph 2. Looking forward to playing with it. |
These look interesting: |
Not gonna happen in this codebase |
Thinking about React.js treating the browser more like GPU / game engine programming ("repaint whole app, only changed parts get wet").
The SVG #66 branch is going to make our current design nicer to implement.
But planning for the future, I think we're going to end up doing everything in WebGL for the control and speed. How could React's concept of virtual DOM be structured with FBP logic and WebGL views?
Cons:
The text was updated successfully, but these errors were encountered: