Hacker News new | ask | show | jobs
by gacek 5290 days ago
WebGL is not a poor-man's subset of OpenGL, its the same subset that is supported by most mobile devices (OpenGL ES2.0). What are you missing? Quads? 3D textures? NURBS?

And yes, we know that JS is interpreted and that it's no use for building anything more than a clock on your webpage, right?

2 comments

>> WebGL is not a poor-man's subset of OpenGL, its the same subset that is supported by most mobile devices (OpenGL ES2.0).

WebGL is just that, a poor-man's subset of OpenGL. As is OpenGL ES 2, which is a standard that's deprecating very fast as mobile GPU's pack more and more kick-ass.

OpenGL ES standardization efforts are badly left behind the development, as graphics vendors are adding more and more extensions to GLES in their implementations. These extensions tend to be a little stripped down versions of desktop GL features and the worst thing is that they're not quite compatible with desktop GL or even similar extensions form other vendors. Next version of GLES (codename "Halti") has to be standardized pretty fast or it will be out of date by the time it comes out.

If you want to write high quality 3d games or graphics using GLES2, you will have to use vendor specific extensions and write code specifically for the devices you intend to ship on. If you're doing something very basic, you may get away with using only the features in GLES2, but you'll still have to consider how to match the performance to the wide array of GLES2 conformant devices out there. It also helps if you're a part of a major graphics vendor's developer partnership program, like it or not.

WebGL's standardization cycle probably even slower. It took a while for the spec to reach maturity and major browsers implementing it. AFAIK, there's no extension mechanism to gain access to not-yet-standardized features. When the next version of OpenGL ES comes out, how long will it take for it's new features to come available to WebGL? Is the WebGL API even designed for extendability? Who are the industry players willing to contribute their engineering efforts to building WebGL specs and implementations?

Could you write (graphically) Battlefield 3 in WebGL, assuming you'd be able to compile it to run efficiently?

As for your second question, JS is very useful, I love JS, I write 90% of my code in JS. But we're talking sophisticated 3d apps here, not whether it's useful at all.

Yes you can. Have you seen Team Fortress 2 in WebGL?

http://www.youtube.com/watch?v=DQrC5YLKFUY

http://www.youtube.com/watch?v=Lmvj6-CFbbA

JS is not very pleasant to code with, so writing an actual game logic could be a bit painful, but so is development for PS3 and it's done somehow. It's not a question of performance, rather about workflow and structures provided by language.

JS has gotchas and some really bad parts, but if you know the language well and know what you're doing, I think it's quite pleasant actually for many problems. Have you done much programming with JS, and if so, what was so unpleasant about it?

Though, I think I've heard pretty much all the complaints against JavaScript, many of which are addressed by using something like CoffeeScript.

I'm using Google Closure to get rid of the bad parts, but still it's not very good. I did some testing with game AI, graphics and so on - JS is far from perfect for such things. Maybe it's a lack of tools, maybe of some features I was used to in C++ or maybe it's that all the books and tutorials are targeted for C++.

It doesn't really matter, browser games are the future and no matter how complicated it's going to be, somebody will be good enough to write them. We already passed "demo era" and some games are really good, like https://chrome.google.com/webstore/detail/bhoaojooagiaaiidln...

But why do you need to write BF3? There are tons of games besides 3D shooters. Could you write minecraft in WebGL? I bet.