Deploy WebGL applications as native iOS or Android applications?

As an extension to Joris’ answer (which appears to be based on the work of Nathan de Vries), the following is the code I needed to enable WebGL within the iOS 5.0 SDK:

Somewhere near the top of your view controller implementation:

@interface UIWebView()
- (void)_setWebGLEnabled:(BOOL)newValue;
@end

Programmatically creating a UIWebView and enabling WebGL:

UIWebView *webDetailView = [[UIWebView alloc] initWithFrame:mainScreenFrame];

id webDocumentView = [webDetailView performSelector:@selector(_browserView)];
id backingWebView = [webDocumentView performSelector:@selector(webView)];
[backingWebView _setWebGLEnabled:YES];

I created a sample application that demonstrates WebGL running in a iPhone / iPad fullscreen UIWebView, using the WebGL scratchpad site http://glsl.heroku.com as a destination. Be wary that some of those examples there will grind even an iPad 2 to a halt, potentially leading to a hard reboot. The performance there seems to indicate why WebGL is still in an officially unsupported state in mobile WebKit.

Of course, as has been stated, this is not guaranteed to work on future iOS versions and will get your application rejected from the App Store. This is only really useful for hobby work and internal testing.

An example of WebGL running on my iPad 2:

enter image description here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)