Categories
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

http://atnan.com/blog/2011/11/03/enabling-and-using-webgl-on-ios/

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

https://github.com/gauthiier/GoWebGL

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.

Categories
WebGL

WebGL 1.0 API Quick Reference Card

A useful quick reference guide to WebGL 1.0

WebGL 1.0 API Quick Reference Card (pdf)

Categories
Projects WebGL

SceneJS – Simple Example

Here’s a simple example showing the structure of the SceneJS scenegraph

Categories
Projects WebGL

SceneJS

SceneJS is an open-source 3D engine for JavaScript which provides a JSON-based scene graph API on WebGL.

http://scenejs.org/

Version 2.0.0 was released on Nov 15 2011 and appears significantly different from its previous version.

The wiki contains lots of information and can be read at

https://github.com/xeolabs/scenejs/wiki

Categories
WebGL

WebGL

WebGL brings plugin-free 3D to the web and is a royalty-free web standard for a low-level 3D graphics API based on OpenGL ES 2.0, exposed through the HTML5 Canvas element as Document Object Model (DOM) interfaces

WebGL code utilises the computer display card’s Graphics Processing Unit (GPU), which must provide support for shader rendering.

Version 1.0 of the specification was released on March 3, 2011 and is based on OpenGL ES 2.0 Details can be found at

https://www.khronos.org/registry/webgl/specs/1.0/

WebGL is managed by the non-profit Khronos Group.

http://www.khronos.org/webgl/

and is currently supported in the Safari 5.1 (Apple), Chrome v9.0 (Google), Firefox v8.0 (Mozilla) and Opera v1 (Opera) web-browsers. Microsoft has not announced any plans to provide support for WebGL.

One of the first applications based on WebGL was Google Body which has formed the basis of the open source project open-3d-viewer. 

http://code.google.com/p/open-3d-viewer/

Several libraries have been created to help with the development of WebGL applications.

One of these is SceneJS which will be explored in later posts.