This project(at least for me) is a little bit misleading.
Because it isn't rendering HTML using WebGL.
It using html2canvas[0] to rasterize the browser rendering into a canvas, upload it to WebGL, apply effects and patch-back events(i.e. mouse clicks) back to the hidden browser dom elements.
(On the other side, font hinting and such are not really a problem)
Implementing full UI framework over WebGL has it merits, and hopefully someone will make a useful(and not html+css based) one some day.
>Implementing full UI framework over WebGL has it merits, and hopefully someone will make a useful(and not html+css based) one some day
I'm surprised it hasn't been done already (in similar spirit to the Feathers framework for Flash's Stage3D). Now that WebGL is supported in Mobile WebView, maybe you'll see a really good component set released? That would give devs a really slick option for building smooth phone-gap based apps.
Yet another instance of html2canvas being used to do something interesting. It's the library I have been surprised by more than any other, for any language.
Make it feature complete and you'll get the same speed the browser has.
If we're going to build a new rendering engine for the web, maybe we could try to create something nicer than HTML and CSS, whose only advantage at the present is the number of developers familiar with it. I know I wouldn't miss them.
Yep, the model of HTML-CSS-DOM-JS implies extreme overhead, and only heroic efforts and thousands of man-years of work and optimization have made it bearable.
I'm saying this as I have compared the performance of a simple local web page with a simple view with the same exact functionality rendered with my pet naive unoptimized UI engine and the latter was blazingly fast compared to HTML.
So I guess you are right, we definitely need something less cluttered and more efficient than HTML+CSS+JS.
That's the opposite direction you want to go. At that point, you might as well just use HTML. I think there are benefits to providing a subset of HTML features that you can tailor for super fast performance.
Wait wait wait...
Handling textures via CG Buffers is quite fast you are right and you can basically do whatever you want in terms of image manipulation using the shaders but you'll lose efficiency as soon as you introduce complex picking (text selection for example) and / or computations (aliasing etc...) between JS and your pseudo-DOM.
In the end the only difference you'll have compared to the real browser renderer is that you do less computations from CG(GL) to RAM (JS), hence the performance.
You can check this very old project of mine where we tried to link DOM and WebGL Nodes: https://github.com/aout/SAGE
edit: just saw the repo wasn't entirely up to date. Done now.
Very cool. This could be useful for some applications, but I don't see it becoming a thing for general use cases unless it's implemented and exposed directly by the browsers.
Even then, the main problem is that the internet is still mostly text, and if you can't implement or access font hinting, your text will be blurry and ugly on any display that isn't ultra-high DPI. You can't really render text to a texture and then manipulate that texture with sub-pixel precision. It must be done the other way around: text rendering must be done last, and with the help of a hinting library so it will look sharp and readable.
This creates an interesting change in how applications are deployed to users. Instead of the user choosing the HTML rendering engine, the developer now gets to choose it. Instead of having to design sites with multiple rendering engines in mind, this makes it possible to manage only one. And it's not like the user cares that content is being rendered by Firefox or Chrome or whatever, the user just cares to see the page, leaving the selection of the actual rendering engine only of concern to the developer.
I think that's important enough to warrant going through the paces and implementing this. Don't listen to the naysayers. Reinvent wheels. The wheels we currently have largely suck.
Really great work. I've had in the back of my mind that this was possible, but now you've gone and done it, and quite well!
I'm curious if there would be any conflict with usage of Three.js on the same site? Could they end up clobbering each other's textures? (I've not gotten into webgl's texture memory management, so that question is a stab in the dark.)
This was at least kind of possible (not sure if it worked only for images or also other elements) with Internet Explorer 4 [1] in 1997, almost two decades ago. It was obviously non-standard.
Would forms and input fields still work? Could one push their wysiwyg rich text editor into this? (I'm thinking game / VR content where an in-3D-world web browser on some in-3D-world device screen is fully operational.)
It depends on how far it will go. At the moment there is a plan how to do that, but not enough time to implement... You may use it for editor, but keep in mind that text itself would be sent to GPU every time it updates. Anyhow you may ping me in skype lp_funky if interested in doing this, would be glad to help.
I think could be nice. There is an intention to create React-GL, but nothing serious yet. All you basically need is to call something like new GLElement(this.getDOMNode()). Or how is it in 0.13?...
I wonder what exactly the use of this is, beyond Compiz for web pages. What's next, jiggly divs? :P
moron4hire made a good point about letting devs pick the layout engine, but I am not sure we want to ignore all the nice features browsers give us here.
It is already there https://www.chromeexperiments.com/webgl , but it starts to be even more exciting if you think about effects which could be applied to web sites and HTML content... Bumb mapping, reflections, motion blur, elastic elements when dragging. Whole bunch of shaders https://www.shadertoy.com/browse
Demoscene is not about flashy graphics. It's about doing something beautiful with code (this includes the way the code uses the machine to do things that go beyond, like mode 13h).
As far as I understand, this is roughly how iOS UI works (UIView - CALayer).
Obviously, this can be done at the browser engine level.
I have also tried to do this in my pet UI engine, but found out that it was tricky to figure out caching rules to avoid memory blowup and performance degradation for all possible cases.
[+] [-] SoapSeller|11 years ago|reply
It using html2canvas[0] to rasterize the browser rendering into a canvas, upload it to WebGL, apply effects and patch-back events(i.e. mouse clicks) back to the hidden browser dom elements. (On the other side, font hinting and such are not really a problem)
Implementing full UI framework over WebGL has it merits, and hopefully someone will make a useful(and not html+css based) one some day.
[0] https://github.com/niklasvh/html2canvas
[+] [-] macspoofing|11 years ago|reply
I'm surprised it hasn't been done already (in similar spirit to the Feathers framework for Flash's Stage3D). Now that WebGL is supported in Mobile WebView, maybe you'll see a really good component set released? That would give devs a really slick option for building smooth phone-gap based apps.
[+] [-] fapjacks|11 years ago|reply
[+] [-] Polarity|11 years ago|reply
[+] [-] phn|11 years ago|reply
If we're going to build a new rendering engine for the web, maybe we could try to create something nicer than HTML and CSS, whose only advantage at the present is the number of developers familiar with it. I know I wouldn't miss them.
[+] [-] paraboul|11 years ago|reply
Previous HN thread : https://news.ycombinator.com/item?id=6314961
video : https://www.youtube.com/watch?t=63&v=BSzEZXUTXlQ
[+] [-] perdunov|11 years ago|reply
I'm saying this as I have compared the performance of a simple local web page with a simple view with the same exact functionality rendered with my pet naive unoptimized UI engine and the latter was blazingly fast compared to HTML.
So I guess you are right, we definitely need something less cluttered and more efficient than HTML+CSS+JS.
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] macNchz|11 years ago|reply
Given the sheer number of people familiar with it, I'd say this is a pretty huge advantage.
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] macspoofing|11 years ago|reply
That's the opposite direction you want to go. At that point, you might as well just use HTML. I think there are benefits to providing a subset of HTML features that you can tailor for super fast performance.
[+] [-] shimonamit|11 years ago|reply
[+] [-] emodendroket|11 years ago|reply
[+] [-] aout|11 years ago|reply
In the end the only difference you'll have compared to the real browser renderer is that you do less computations from CG(GL) to RAM (JS), hence the performance.
You can check this very old project of mine where we tried to link DOM and WebGL Nodes: https://github.com/aout/SAGE
edit: just saw the repo wasn't entirely up to date. Done now.
[+] [-] bsenftner|11 years ago|reply
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] pierrec|11 years ago|reply
Even then, the main problem is that the internet is still mostly text, and if you can't implement or access font hinting, your text will be blurry and ugly on any display that isn't ultra-high DPI. You can't really render text to a texture and then manipulate that texture with sub-pixel precision. It must be done the other way around: text rendering must be done last, and with the help of a hinting library so it will look sharp and readable.
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] methyl|11 years ago|reply
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] moron4hire|11 years ago|reply
I think that's important enough to warrant going through the paces and implementing this. Don't listen to the naysayers. Reinvent wheels. The wheels we currently have largely suck.
[+] [-] perdunov|11 years ago|reply
[+] [-] slaction|11 years ago|reply
[+] [-] bsenftner|11 years ago|reply
I'm curious if there would be any conflict with usage of Three.js on the same site? Could they end up clobbering each other's textures? (I've not gotten into webgl's texture memory management, so that question is a stab in the dark.)
[+] [-] danbruc|11 years ago|reply
[1] https://msdn.microsoft.com/en-us/library/ms532849.aspx
[+] [-] mandeepj|11 years ago|reply
Reference - https://news.ycombinator.com/item?id=9029159
[+] [-] bsenftner|11 years ago|reply
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] cturhan|11 years ago|reply
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] josephmx|11 years ago|reply
[+] [-] heldrida|11 years ago|reply
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] kolodny|11 years ago|reply
[+] [-] bshimmin|11 years ago|reply
[+] [-] jeremiep|11 years ago|reply
[+] [-] kluck|11 years ago|reply
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] angersock|11 years ago|reply
I wonder what exactly the use of this is, beyond Compiz for web pages. What's next, jiggly divs? :P
moron4hire made a good point about letting devs pick the layout engine, but I am not sure we want to ignore all the nice features browsers give us here.
[+] [-] MrDosu|11 years ago|reply
Also, css shaders.
[+] [-] outworlder|11 years ago|reply
[+] [-] theandrewbailey|11 years ago|reply
http://www.pouet.net/prodlist.php?platform[]=JavaScript&page...
[+] [-] PixelsCommander|11 years ago|reply
[+] [-] MrDosu|11 years ago|reply
[+] [-] perdunov|11 years ago|reply
Obviously, this can be done at the browser engine level.
I have also tried to do this in my pet UI engine, but found out that it was tricky to figure out caching rules to avoid memory blowup and performance degradation for all possible cases.
[+] [-] designml|11 years ago|reply