WebGL (Short for Web Graphics Library) is a JavaScriptAPI for rendering interactive 2D and 3D graphics within any compatible web browser without the use of plug-ins.[2] WebGL is fully integrated with other web standards, 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.[3]
WebGL programs consist of control code written in JavaScript and shader code that is written in OpenGL ES Shading Language (GLSL ES), a language similar to C or C++, and is executed on a computer's graphics processing unit (GPU). WebGL is designed and maintained by the non-profit Khronos Group.[4]
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, if so required, has to be implemented by the end-developer by providing shader code and configuring data bindings in JavaScript.
Shaders in WebGL are expressed directly in GLSL and passed to the WebGL API as textual strings. The WebGL implementation compiles these shader instructions to GPU code. This code is executed for each and every vertex sent through the API and for each pixel rasterized to the screen.
History
WebGL evolved out of the Canvas 3D experiments started by Vladimir Vukićević at Mozilla. Vukićević first demonstrated a Canvas 3D prototype in 2006. By the end of 2007, both Mozilla[7] and Opera[8] had made their own separate implementations.
In early 2009, the non-profit technology consortium Khronos Group started the WebGL Working Group, with initial participation from Apple, Google, Mozilla, Opera, and others.[4][9] Version 1.0 of the WebGL specification was released March 2011.[1] As of March 2012, the chair of the working group is Ken Russell.
Early applications of WebGL include Zygote Body.[10][11] In November 2012 Autodesk announced that they ported most of their applications to the cloud running on local WebGL clients. These applications included Fusion 360 and AutoCAD 360.[12]
Development of the WebGL 2 specification started in 2013 with final in January 2017.[13] This specification is based on OpenGL ES 3.0.[14]
First implementations are in Firefox 51, Chrome 56 and Opera 43.[15]
Implementations
Almost Native Graphics Layer Engine
Main article: ANGLE (software)
Almost Native Graphics Layer Engine (ANGLE) is an open source graphic engine which implements WebGL 1.0 (2.0 which closely conforms to ES 3.0) and OpenGL ES 2.0 and 3.0 standards. It is a default backend for both Google Chrome and Mozilla Firefox on Windows platforms and works by translating WebGL and OpenGL calls to available platform-specific APIs. ANGLE currently provides access to OpenGL ES 2.0 and 3.0 to desktop OpenGL, OpenGL ES, Direct3D 9, and Direct3D 11 APIs.[16] ″[Google] Chrome uses ANGLE for all graphics rendering on Windows, including the accelerated Canvas2D implementation and the Native Client sandbox environment.″[17]
Software
WebGL is widely supported by modern browsers. However its availability is dependent on other factors like the GPU supporting it. The official WebGL website offers a simple test page.[18] More detailed information (like what renderer the browser uses, and what extensions are available) is provided at third-party websites.[19][20]
Desktop browsers
Google Chrome – WebGL 1.0 has been enabled on all platforms that have a capable graphics card with updated drivers since version 9, released in February 2011.[21][22] By default on Windows, Chrome uses the ANGLE (Almost Native Graphics Layer Engine) renderer to translate OpenGL ES to Direct X 9.0c or 11.0, which have better driver support.[23] On Linux and Mac OS X the default renderer is OpenGL however.[24] It is also possible to force OpenGL as the renderer on Windows.[23] Since September 2013, Chrome also has a newer Direct3D 11 renderer, which however requires a newer graphics card.[25][26] Chrome 56+ supports WebGL 2.0.
Firefox – WebGL 1.0 has been enabled on all platforms that have a capable graphics card with updated drivers since version 4.0.[27] Since 2013 Firefox also uses DirectX on the Windows platform via ANGLE.[23] Firefox 51+ supports WebGL 2.0.
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 1.0, which was disabled by default before Safari 8.0.[28][29][30][31][32] Safari version 12 (available in MacOS Mojave) has available support for WebGL 2.0, currently as an "Experimental" feature.
Opera – WebGL 1.0 has been implemented in Opera 11 and 12, although was disabled by default in 2014.[33][34] Opera 43+ supports WebGL 2.0.
Internet Explorer – WebGL 1.0 is partially supported in Internet Explorer 11.[35][36][37][38] 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.[39] WebGL support can also be manually added to earlier versions of Internet Explorer using third-party plugins such as IEWebGL.[40]
Microsoft Edge – The initial stable release supports WebGL version 0.95 (context name: "experimental-webgl") with an open source GLSL to HLSL transpiler.[41] Version 10240+ supports WebGL 1.0 as prefixed. WebGL 2.0 is planned with medium priority in future releases.[42]"updates will start when reopen Google chrome.
Mobile browsers
BlackBerry 10 – WebGL 1.0 is available for BlackBerry devices since OS version 10.00[43]
BlackBerry PlayBook – WebGL 1.0 is available via WebWorks and browser in PlayBook OS 2.00[44]
Android Browser – Basically unsupported, but the Sony Ericsson Xperia range of Android smartphones have had WebGL capabilities following a firmware upgrade.[45] 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 the Android browser in many phones (but is not a new standard Android Browser).
iOS – WebGL 1.0 is available for mobile Safari, in iOS 8.[54]
Tools and ecosystem
Utilities
The low-level nature of the WebGL API, which provides little on its own to produce desirable 3D graphics quickly, contributed to creation of libraries which are typically used to build things up in 3D graphics (e.g. view transformations for shaders, view frustum etc.). Basic tasks such as loading scene graphs and 3D objects in the popular industry formats is also abstracted by the libraries (some of which were ported to JavaScript from other languages) to provide additional functionality. A non-exhaustive list of libraries that provide many high-level features includes A-Frame (VR), BabylonJS, PlayCanvas, three.js, OSG.JS and CopperLicht. X3D also made a project called X3DOM to make X3D and VRML content running on WebGL. The 3D model will in XML tag <X3D> in HTML5 and interactive script will use JavaScript and DOM. BS Content Studio and InstantReality X3D exporter can exported X3D in HTML and running by WebGL.[citation needed]
Gavd
There also has been a rapid emergence of game engines for WebGL, both 2D and 3D,[55] including Unreal Engine 4 and Unity.[56] The Stage3D/Flash-based Away3D high-level library fgsegesssssrf
also has a port to WebGL via TypeScript. A more light-weight utility library that provides just the vector and matrix math utilities for shaders is sylvester.js. It is sometimes used in conjunction with a WebGL specific extension called glUtils.js.[57]
There are also some 2D libraries built on top of WebGL like Cocos2d-x or Pixi.js, which were implemented this way for performance reasons, in a move that parallels what happened with the Starling Framework over Stage3D in the Flash world. The WebGL-based 2D libraries fall back to HTML5 canvas when WebGL is not available.
Removing the rendering bottleneck by giving almost direct access to the GPU also exposed performance limitations in the JavaScript implementations. Some were addressed by asm.js and WebAssembly (similarly, the introduction of Stage3D exposed performance problems within ActionScript, which were addressed by projects like CrossBridge).[58]
Content creation
Like for any other graphics API, creating content for WebGL scenes requires using a regular 3D content creation tool and exporting the scene to a format that is readable by the viewer or helper library. Desktop 3D authoring software such as Blender, Autodesk Maya or SimLab Composer can be used for this purpose. Particularly, Blend4Web allows a WebGL scene to be authored entirely in Blender and exported to a browser with a single click, even as a standalone web page.[59] There are also some WebGL-specific software such as CopperCube and the online WebGL-based editor Clara.io. Online platforms such as Sketchfab and Clara.io allow users to directly upload their 3D models and display them using a hosted WebGL viewer.
Environment based tools
Additionally, Mozilla Foundation, in its Firefox browser, has implemented built-in WebGL tools starting with version 27 that allow editing vertex and fragment shaders.[60] A number of other debugging and profiling tools have also emerged.[61]
See also
List of WebGL frameworks
Experience Curiosity – WebGL simulation of the Mars rover Curiosity
WebVR
Java OpenGL – OpenGL library for the Java programming language