News for hackers. Stuff that matters.
Re:Show HN: I built an online image editor using WebGL and C... by Gehinnn on Monday September 16, 2019 @06:18AM (#20982622)
Nice ;) How come you use WebGL rather than e.g. SVG?
Re:Show HN: I built an online image editor using WebGL and C... by rikschennink on Monday September 16, 2019 @06:53AM (#20982801)
Initially I rendered the image preview with CSS 3D transforms, while super fast on Safari, it turned out this wasn't as performant on Chrome when viewing on a retina display (weird right?). So I switched to WebGL, which sits closer (closest?) to the hardware and therefor yields better results. It's now super fast, it can animate filter transitions at 60FPS.

SVGs currently don't support hardware acceleration, so that's why I went with CSS transforms for other parts of the UI. The only things rendered with SVG at the moment are the markup, the UI icons, and the rotation control.

Re:Show HN: I built an online image editor using WebGL and C... by w56rjrtyu6ru on Monday September 16, 2019 @06:26AM (#20982665)
Correct me if I'm wrong, but I think WebGL is the most performant graphics pipeline available in browsers today.

I'm hooked on SVG's promise of semantic graphics, but every time I tried building something with SVG in a browser the performance just wasn't there, especially on low-end devices.

Re:Show HN: I built an online image editor using WebGL and C... by rikschennink on Monday September 16, 2019 @07:52AM (#20983138)
You're absolutely right, you either go for CSS 3D Transforms, or WebGL, WebGL being faster still.
Re:Show HN: I built an online image editor using WebGL and C... by aloer on Monday September 16, 2019 @12:52PM (#20986008)
What’s your take on 2d canvas? I always see these 2d Toole using webgl and wonder how big of a difference it is.

Filters of course work best in webgl. But the rest?

Also, do you use offscreencanvas in chrome?

Re:Show HN: I built an online image editor using WebGL and C... by rikschennink on Tuesday September 17, 2019 @03:01AM (#20992430)
Every operation is just way faster in WebGL.

I currently use WebGL for display preview and 2D canvas for generating the actual image.

I suspect you'll run into performance issues if you plan to animate the image in a 2D canvas context (like I do when rotating / flipping / etc.)

I've been planning to use offscreencanvas but haven't gotten around to it yet.

Re:Show HN: I built an online image editor using WebGL and C... by onion2k on Monday September 16, 2019 @06:47AM (#20982772)
Performance.