Vous êtes sur la page 1sur 5

WebGL Case Study on Different Platforms and OS

What is WebGL?
WebGL (Web Graphics Library) is a JavaScript API for rendering interactive 3D
graphics and 2D graphics within any compatible web browser without the use
of plug-ins. WebGL is integrated completely into all the web standards of the
browser allowing GPU accelerated usage of physics and image processing and
effects as part of the web page canvas. WebGL elements can be mixed with other
HTML elements and composited with other parts of the page or page
background. WebGL programs consist of control code written in JavaScript
and shader code that is executed on a computer's Graphics Processing Unit (GPU).
WebGL is designed and maintained by the non-profit Khronos Group.
WebGL is based on OpenGL ES 2.0 and provides an API for 3D graphics.[5] It uses
the HTML5 canvas element and is accessed using Document Object
Model interfaces. Automatic memory management is provided as part of
the JavaScript language.
Like OpenGL ES 2.0, WebGL does not have the fixed-function APIs introduced in
OpenGL 1.0 and deprecated in OpenGL 3.0. This functionality can instead be
provided by the user in the JavaScript code space.
Shaders in WebGL are expressed directly in GLSL.
WebGL can run without OpenGL. There is a compatibility library called Angle which
translates WebGL Shaders to either:

Desktop OpenGL GLSL (on Linux and OSX)


Mobile OpenGL ES 2.0 ESSL (on android and blackberry)
Direct3D 9 HLSL (on windows)

WebGL API calls are also translated:

Desktop OpenGL (each browser supplies his own wrapper for that)
Mobile OpenGL ES 2.0 (just a pipe trough)
Direct3D 9 API (Angle provides a wrapper for that)

Browser Support
Desktop browsers
Google Chrome WebGL has been enabled on all platforms that have a capable
graphics card with updated drivers since version 9, released in February 2011. By
default on Windows Chrome uses the ANGLE (Almost Native Graphics Layer Engine)
renderer to translate OpenGL ES to Direct X 9.0c, which has better driver
support. On Linux and Mac OS X the default renderer is OpenGL however. It is also
possible to force OpenGL as the renderer on Windows. Since September 2013,
Chrome also has a newer Direct3D 11 renderer, which however requires a newer
graphics card.
Mozilla Firefox WebGL has been enabled on all platforms that have a capable
graphics card with updated drivers since version 4.0. Nowadays Firefox also uses
ANGLE on Windows.
Safari Safari 6.0 and newer versions installed on OS X Mountain Lion, Mac OS X
Lion and Safari 5.1 on Mac OS X Snow Leopard implemented support for WebGL,
which was disabled by default before Safari 8.0.
Opera WebGL has been implemented in Opera 11 and 12, although disabled by
default.
Internet Explorer WebGL is partially supported in Internet Explorer 11. It initially
failed the majority of official WebGL conformance tests, but Microsoft later released
several updates. The latest 0.94 WebGL engine currently passes ~97% of Khronos
tests. WebGL support can also be manually added to earlier versions of Internet
Explorer using third-party plugins such as IEWebGL.

Mobile browsers
Android Browser - Basically unsupported, but the Sony Ericsson Xperia range of
Android smartphones have had WebGL capabilities following a firmware
upgrade. Samsung smartphones also have WebGL enabled (verified on Galaxy SII
(4.1.2) and Galaxy Note 8.0 (4.2)). Supported in Google Chrome that replaced
Android browser in many phones (but is not a new standard Android Browser).
Internet Explorer - WebGL is available on Windows Phone 8.1
BlackBerry PlayBook WebGL is available via WebWorks and browser in PlayBook
OS 2.00
Firefox for mobile WebGL is available for Android devices since Firefox 4.

Firefox OS
Google Chrome - WebGL is available for Android devices since Google Chrome 25
and enabled by default since version 30.
Maemo - In Nokia N900, WebGL is available in the stock microB browser from the
PR1.2 firmware update onwards.
Opera Mobile - Opera Mobile 12 supports WebGL (on Android only).
Tizen
Ubuntu Touch
WebOS
iOS - Mobile Safari supports WebGL in iOS 8.

WebGL and Browser Worldwide statistics from October 2014

Platform Support
If a platform works or not depends a bit on driver versions, OS versions and other
factors. This is known as a Whitelist/Blacklist.
WebGL runs almost on all major platforms if this platform allows the installation of
browsers
There are however platforms where WebGL will not run no matter what:

Windows on ARM (surface etc.)


Windows Phones
Windows 8 Modern UI
iOS (iPhone, iPad etc.)

This is because Microsoft and Apple have not implemented WebGL and they disallow
other browsers for these platforms. You might find this perplexing since you can find
other browsers in these devices App-Stores. However these browsers are just
different decorations for Internet Explorer or mobile Safari engines, and unless a
browser can make his own engine, WebGL cannot be supported.

Comparison to different platforms


Unity 3D
This is an engine more than an API. Most people don't have the Unity3D Web-Player
installed, and it doesn't run on mobiles anyway. If an engine is your thing, and you
don't care about the web as much, you should try it. I like APIs and the Web a lot, so
I don't really use it.
Note that there are ways to bring Unity 3D to the web (and to mobiles).
It can be compiled to Google Chrome only NaCL (obvious drawbacks). But that still
isn't integrative with the host of web technologies in that none of the various
frameworks, libraries etc. available for HTML/CSS/JS will be any use to you.
It can be compiled to run on mobiles and be distributed in App-Stores, but that isn't
really the same as putting it on a webpage and have it "click -> play".
Flash Stage 3D

Flash uses a non-standard API (neither like Direct3D nor like OpenGL) that seems to
be fairly poorly documented (at least the documentation I could find was sparse at
best). An unfortunate choice is also flashs shader format, which is
practically programming assembler. WebGL allows you to program in a convenient
high level C like language. Of course Flash also doesn't run on mobiles (the old
story). But from a Web-Developers point of view, it also does not integrate with any
of the web technologies. You also need to precompile all your shaders,
and compiling shaders online is not possible.
However you can compile flash to run on mobiles with some of the half-dozen or so
services/technologies that repackage your flash app to a native app and let it
distribute on an App-Store. But again, like Unity 3D, that's not quite the same as
putting it on a webpage and have it "click -> play" (one of the biggest traditional
strengths of flash).
Silverlight 3D
Microsoft has not given Silverlight much love, much less Silverlight 3D. Aparts from
the usual inconveniences (doesn't run on mobiles, needs a plugin, poorly
documented etc.) you also need to precompile your shaders. Of course you need
Visual Studio and .Net and whatever to even start writing anything in Silverlight.
The biggest hurdle however is that Microsoft makes users jump trough half a dozen
obscure dialogs to enable 3D for every single silverlight application that wants to
use 3D. Last I heard it's practically impossible to do, so this isn't really a choice.
Direct3D
Doesn't run on the Web. Doesn't run on mobiles. Doesn't run on Apple. It's a non
standardized API.
OpenGL
Serious driver issues, doesn't run on the Web. Doesn't run on mobiles.
OpenGL ES
Doesn't run on Desktops. Runs on a lot of mobiles, but doesn't run on the Web.