4 ms·
Some people are mentioning that this doesn't work on iOS, and that's because Apple doesn't have WebGL available in mobile versions of Safari. But it is. This p
by double051 13y ago
Some people are mentioning that this doesn't work on iOS, and that's because Apple doesn't have WebGL available in mobile versions of Safari.
But it is. This post by Nathan de Vries [0] shows how you can hack the UIWebView to enable WebGL contexts in your iOS apps. You have to get a little more creative these days (the compiler has gotten stricter about private types and functions), but all it takes is something like this:
-(void)setWebGLEnabled:(BOOL)enableWebGL forWebView:(UIWebView *)uiWebView
{
id webDocumentView = [uiWebView performSelector:@selector(_browserView)];
id backingWebView = [webDocumentView performSelector:@selector(webView)];
[backingWebView performSelector:@selector(_setWebGLEnabled:)
withObject:[NSNumber numberWithBool:enableWebGL]];
}
It should go without saying that code like this will not make it into the app store.
[0] http://atnan.com/blog/2011/11/03/enabling-and-using-webgl-on-ios http://atnan.com/blog/2011/11/03/enabling-and-using-webgl-on...
- q3k 13y agoWhy the hell would Apple disable WebGL by default, if they went through the trouble of somehow getting it working in the first place..? Incredible.
- kcbanner 13y agoProbably security concerns. Graphics drivers have not been audited for security in the past because they were not accessible via the web.
- gisenberg 13y agoWebGL is enabled for ads published through iAd, but disabled for anything else.
- Florin_Andrei 13y agoWow. That's disgusting.
- untog 13y agoIt actually makes sense, infuriating though it is. Individual iAds are vetted by Apple, so any WebGL vulnerabilities aren't a problem. Of course, it would be better if Apple just tested the damn WebGL vulnerabilities. Not like they have to worry about many graphics cards.
- sirkneeland 13y ago2 possible reasons: 1. so they could be prepared to rapidly enable it if market exigencies required them to (say, if webGL experiences for whatever reason started blowing up on competitor platforms). 2. they have some other, grander plan behind webGL that we don't know about yet. Maybe someday they want Xcode to be the premier web app dev tool Remember this is from the company that developed Mac OS X in parallel for PowerPC and x86 "just in case"...clearly they plan for the future
- foldor 13y agoThey didn't develop them in parallel. One programmer took it upon himself alone, and without telling Apple, to do the initial port to x86.[1] [1] Insider cuts into Apple, peels off Intel Mac OS X port secrets - http://www.theregister.co.uk/2012/06/11/apple_project_marklar_secrets/ http://www.theregister.co.uk/2012/06/11/apple_project_markla...
- mixmastamyk 13y agoNeXT ran on intel so it probably wasn't too difficult.
- sirkneeland 13y agoInteresting background stuff! I didn't know, thanks for sharing.
- lunixbochs 13y agoThis specific demo still won't work on iOS devices predating the A7's GPU, due to OpenGL extension(s) used. (Doesn't work on my iPhone 5 even with WebGL enabled.)