Code Snippets WebGL

WebGL on the iPad

I recently wanted to access some WebGL based web-sites from my iPad and quickly discovered that WebGL is currently NOT supported, or at least not enabled, in the iPad’s version of Safari.

However, Nathan de Vries discovered that the UIWebView class does seem to have in-built support for WebGL. Read all the details at

This work evolved into GoWebGL, which  is an example of how a simple WebGL supported browser can be written for iOS5 devices

In the example app, simple gestures and inputs are provided allowing a user to enter a required URL in a text edit box launched using a two finger double-tap, to browse forward by a swipe left or browse backwards with a swipe right.

Support for WebGL in UIWebView is enabled as shown in the following code extract

//-> init + setup UIWebView (from Nathan)
    UIWebView* webView = [[[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    id webDocumentView = [webView performSelector:@selector(_browserView)];
    id backingWebView = [webDocumentView performSelector:@selector(webView)];
    [backingWebView _setWebGLEnabled:YES]; //<-- !!!

Because this is an undocumented feature, using it is unlikely to be approved by Apple. It does enable me, however, to explore and research the potential for using WebGL applications on the iPad. In the future, I have no doubt that Apple will provide official support for using WebGL on the iPad.

Hints/Tips Tools

Snow Leopard, Xcode 4.2 and iOS 5.1

My Mac Mini is quite old now but still a good workhorse. It’s running the Snow Leopard OS and I use XCode 4.2 for developing iOS applications.

Recently iOS 5.1 was released by Apple and my iPad prompted me to upgrade. Without thinking I went ahead and performed the software update.

A day or two later, I needed to build an app and connected the iPad as my device which, of course, is no longer recognised because of the OS upgrade. But the iOS 5.1 SDK is only available for Macs running Lion …

… here’s a workaround that will allow you to continue using Snow Leopard and XCode 4.2 It assumes your current XCode 4.2 has been installed to the default location in /Developer

  • Download the Lion based XCode 4.3.1 dmg file

(I used the direct link to Apple Developer downloads at but you have to be a registered developer and have a login and password to access this area

  • Mount the image file
  • Enter the following commands in a Terminal window
    sudo cp -R /Volumes/Xcode/ /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
    sudo cp -R /Volumes/Xcode/ /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
    sudo cp -R /Volumes/Xcode/\ \(9B176\) /Developer/Platforms/iPhoneOS.platform/DeviceSupport/
    sudo rm -f /Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest
    cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport/
    sudo ln -s ./5.1\ \(9B176\) ./Latest
  • Unmount the DMG file

And now my iPad running IOS 5.1 is recognised and works with XCode 4.2