
Enabling & using WebGL on iOS 4.2+ - atnan
http://atnan.com/blog/2011/11/03/enabling-and-using-webgl-on-ios/
======
ryanpetrich
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>

~~~
atnan
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

------
geuis
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.

------
JoshTriplett
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.)

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

------
alastairpat
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.

~~~
irrationalfab
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...](https://developer.apple.com/library/ios/#technotes/tn2239/_index.html)
[http://stackoverflow.com/questions/25636/what-is-the-best-
wa...](http://stackoverflow.com/questions/25636/what-is-the-best-way-to-learn-
assembly-specifically-for-someone-who-has-experi)

~~~
alastairpat
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…

------
pistachiopro
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.

~~~
atnan
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.).

------
marcinignac
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.

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

------
funkaster
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+?

------
alex_unstable
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

~~~
robterrell
Safari and MobileSafari support HTML5 local storage:

[http://developer.apple.com/library/safari/#codinghowtos/Desk...](http://developer.apple.com/library/safari/#codinghowtos/Desktop/DataManagement/_index.html)

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

~~~
alex_unstable
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.

------
brettgo1
Somebody at Apple should hire this Aussie!

------
object2dot0
wow, great this opens up endless possibilities :)

