Hacker News new | comments | show | ask | jobs | submit login
Enabling & using WebGL on iOS 4.2+ (atnan.com)
98 points by atnan 1939 days ago | hide | past | web | 22 comments | favorite



Great work atnan.

Cat's out of the bag, may as well make public my experiment to enable WebGL on all webviews: https://github.com/rpetrich/WebGLEnabler


Hi Ryan,

That's pretty neat! An unfortunate side effect is that running Mobile Safari unsigned negates the 'dynamic-codesigning' entitlement, which means that Nitro is disabled.

That said, a WebGL-enabled UIWebView running in your own app will also not be Nitro-enabled. I've run the PhiloGL spinning world demo on my device and it's running at 40fps, so simpler demos may be possible without a Nitro to boost things a bit.

Cheers,

Nathan


Just as a reminder, if you link against any private api or framework in and app and submit it to the App Store, your app will be denied. You may get lucky and have your app slip through, but expect that at any time it will get removed from the store.


Given that WebKit has support for WebM, I wonder how much work it would take to do the same kind of hack to enable WebM support for the video tag? (More, I suspect, since iOS probably doesn't ship the required libraries.)


For that you'd probably want to dig into WebKit.framework — the private WebPluginController & WebPluginDatabase classes look rather interesting.


Perhaps more interesting than WebGL is actually him documenting the process that he took in figuring out how it worked.

I really wish I had a better understanding of disassembly.


I feel the same. I would love to understand a bit more of what is going on under the hood. I did a quick research but I could not find something quick enough to work as a primer.

The best resources I found are: https://developer.apple.com/library/ios/#technotes/tn2239/_i... http://stackoverflow.com/questions/25636/what-is-the-best-wa...


Those are both really interesting, thanks.

I'm really embarrassed to admit I have very little understanding of what happens below Objective-C. Looks like it's time for me to start reading…


TN2239 is invaluable for debugging and digging through things you shouldn't necessarily be poking around in :-)


Yeah I would love to see more of this type of analysis. It's really revealing and interesting.


Has Apple stated any plans to continue developing WebGL for iOS? It seems like the kind of thing that could compete with their app business.


The argument that WebGL "competes" with OpenGL-ES, to the detriment of Apple, makes very little sense to me.

You only need to look at the number of engineers Apple has contributing to WebKit & new web standards (CSS transitions & animations, WebGL etc.).


On the other hand it's a serious feature of their iAd business.


As an iOS developer I feel that native apps will have a technical edge for a while. WebApps are built with tools that weren't designed for creating GUIs, you can do it but it is much less efficient and effective. This is especially true for complex applications like games (the ones that would benefit the most from webGL).


I put some video going through few WebGL enabled websites and it's looks very promising http://vimeo.com/31644717 The JavaSript performance itself for example in mesh building is really terrible. Trying to benchmark it against Nitro in normal Mobile Safari would be a good thing to do.


Would love to see more about how to read that disassembly and piece all that together.. I'm impressed!


I just tried running the code in an iPhone 4 with iOS 4.3.5 - got a invalid selector (_setWebGLEnabled). Worked just fine with an iTouch 4gen with iOS 5 though... Has anyone tested this on a device with iOS 4.2+?


hey atnan, great article, very insightful, congrats. Seems like Apple has put a lot of effort on improving UIWebviews, there is more than just Nitro, apparently.

I strongly believe the whole HTML5 standard is supported on iOS5 but it has to be enabled. Did anyone notice the SQLite database that's created everytime you use a UIWebview? I've been trying to enable offline navigation and got kinda stuck but this gives me a couple of good new ideas.

Cheers, Alex


Safari and MobileSafari support HTML5 local storage:

http://developer.apple.com/library/safari/#codinghowtos/Desk...

There's nothing you have to do to enable it. Except use it.


I does work on MobileSafari but not on UIWebviews. There's a key called "WebKitOfflineWebApplicationCacheEnabled" that's automatically set to YES but it doesn't seem make any difference. I'm trying to find out why, but for that I need to go down to the dungeons of Apple's private frameworks and there is where I'm struggling at the moment.


Somebody at Apple should hire this Aussie!


wow, great this opens up endless possibilities :)




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: