Jump to content
Wikipedia The Free Encyclopedia

WebGL

From Wikipedia, the free encyclopedia
JavaScript bindings for OpenGL in web browsers
WebGL
Original author Mozilla Foundation
Developer Khronos WebGL Working Group
Initial releaseMarch 3, 2011; 14 years ago (2011年03月03日)[1]
Stable release
2.1 / January 17, 2017; 8 years ago (2017年01月17日)
Platform Cross-platform
Type API
Websitewww.khronos.org/webgl/
HTML
HTML5 logo
HTML and variants
HTML elements and attributes
Editing
Character encodings and language
Document and browser models
Client-side scripting and APIs
Graphics and Web3D technology
Comparisons

WebGL (short for Web Graphics Library) is a JavaScript API 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, image processing, and effects in the HTML 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 written in OpenGL ES Shading Language (GLSL ES, sometimes referred to as ESSL), a language similar to C or C++. WebGL code is executed on a computer's GPU.

WebGL is designed and maintained by the non-profit Khronos Group.[4] On February 9, 2022, Khronos Group announced WebGL 2.0 support from all major browsers.[5]

From 2024, a new graphics API, WebGPU, is being developed to supersede WebGL. WebGPU provides extended capabilities, a more modern interface, and direct GPU access, which is useful for demanding graphics as well as AI applications.

Design

[edit ]

WebGL 1.0 is based on OpenGL ES 2.0 and provides an API for 3D graphics.[6] It uses the HTML5 canvas element and is accessed using Document Object Model (DOM) interfaces.

WebGL 2.0 is based on OpenGL ES 3.0. It guarantees the availability of many optional extensions of WebGL 1.0, and exposes new APIs.[7] Automatic memory management is provided implicitly by JavaScript.[4]

Like OpenGL ES 2.0, WebGL lacks the fixed-function APIs introduced in OpenGL 1.0 and deprecated in OpenGL 3.0. This functionality, if required, has to be implemented by the developer using shader code and JavaScript.

Shaders in WebGL are written in GLSL and passed to the WebGL API as text strings. The WebGL implementation compiles these strings to GPU code. This code is executed for each vertex sent through the API and for each pixel rasterized to the screen.

History

[edit ]

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[8] and Opera[9] 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] [10] Version 1.0 of the WebGL specification was released March 2011.[1]

An early application of WebGL was Zygote Body.[11] [12] In November 2012 Autodesk announced that they ported most of their applications to the cloud running on local WebGL clients. These applications included Autodesk Fusion and AutoCAD.[13]

Development of the WebGL 2 specification started in 2013 and finished in January 2017.[14] The specification is based on OpenGL ES 3.0.[15] First implementations are in Firefox 51, Chrome 56 and Opera 43.[16]

Implementations

[edit ]

Almost Native Graphics Layer Engine

[edit ]
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.[17] ′′[Google] Chrome uses ANGLE for all graphics rendering on Windows, including the accelerated Canvas2D implementation and the Native Client sandbox environment.′′[17]

Software

[edit ]

WebGL is widely supported by modern browsers. However, its availability depends on other factors, too, like whether the GPU supports 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) can be found at third-party websites.[19] [20]

Desktop browsers[2]

[edit ]
  • 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] However, on Linux and Mac OS X, the default renderer is OpenGL.[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 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 as an "Experimental" feature. Safari 15 enables WebGL 2.0 for all users.[33]
  • Opera – WebGL 1.0 has been implemented in Opera 11 and 12, but was disabled by default in 2014.[34] [35] Opera 43+ supports WebGL 2.0.
  • Internet Explorer – WebGL 1.0 is partially supported in Internet Explorer 11.[36] [37] [38] [39] Internet Explorer initially failed most of the official WebGL conformance tests, but Microsoft later released several updates. The latest 0.94 WebGL engine currently passes ≈97% of Khronos tests.[40] WebGL support can also be manually added to earlier versions of Internet Explorer using third-party plugins such as IEWebGL.[41]
  • Microsoft Edge – For Microsoft Edge Legacy, the initial stable release supports WebGL version 0.95 (context name: "experimental-webgl") with an open source GLSL to HLSL transpiler.[42] Version 10240+ supports WebGL 1.0 as prefixed. Latest Chromium-based Edge supports WebGL 2.0.

Mobile browsers

[edit ]

Tools and ecosystem

[edit ]

Utilities

[edit ]

The low-level nature of the WebGL API, which provides little on its own to quickly create desirable 3D graphics, motivated the creation of higher-level libraries that abstract common operations (e.g. loading scene graphs and 3D objects in certain formats; applying linear transformations to shaders or view frustums). Some such libraries were ported to JavaScript from other languages. Examples of libraries that provide high-level features include A-Frame (VR), BabylonJS, PlayCanvas, three.js, OSG.JS, Google’s model-viewer and CopperLicht. Web3D also made a project called X3DOM to make X3D and VRML content run on WebGL.

Games

[edit ]

There has been an emergence of 2D and 3D game engines for WebGL,[56] such as Unreal Engine 4 and Unity.[57] The Stage3D/Flash-based Away3D high-level library also has a port to WebGL via TypeScript.[25] [58] A more light-weight utility library that provides just the vector and matrix math utilities for shaders is sylvester.js.[59] [60] It is sometimes used in conjunction with a WebGL specific extension called glUtils.js.[59] [61]

There are also some 2D libraries built atop 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.[62] Removing the rendering bottleneck by giving almost direct access to the GPU has 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).[62]

Content creation

[edit ]

As with any other graphics API, creating content for WebGL scenes requires using a 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. In particular, 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.[63] 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

[edit ]

Starting from Firefox Version 27, Mozilla has given Firefox built-in WebGL tools that allow the editing of vertices and fragment shaders.[64] A number of other debugging and profiling tools have also emerged.[65]

See also

[edit ]

References

[edit ]
  1. ^ a b "Khronos Releases Final WebGL 1.0 Specification". 3 March 2011. Retrieved 2015年05月18日.
  2. ^ a b "WebGL Fundamentals". HTML5 Rocks.
  3. ^ Parisi, Tony (2012年08月15日). "WebGL: Up and Running". O'Reilly Media, Incorporated. Archived from the original on 2013年02月01日. Retrieved 2012年07月13日.
  4. ^ a b c "WebGL – OpenGL ES 2.0 for the Web". Khronos.org. Retrieved 2011年05月14日.
  5. ^ "WebGL 2.0 Achieves Pervasive Support from all Major Web Browsers". The Khronos Group. 2022年02月09日. Retrieved 2022年02月13日.
  6. ^ "WebGL Specification". Khronos.org. Retrieved 2011年05月14日.
  7. ^ "WebGL 2.0 Specification". Khronos.org. Retrieved 2017年02月27日.
  8. ^ "Canvas 3D: GL power, web-style". Blog.vlad1.com. Archived from the original on 2011年07月17日. Retrieved 2011年05月14日.
  9. ^ "Taking the canvas to another dimension". My.opera.com. 2007年11月26日. Archived from the original on 2007年11月17日. Retrieved 2011年05月14日.
  10. ^ "Khronos Details WebGL Initiative to Bring Hardware-Accelerated 3D Graphics to the Internet". Khronos.org. 2009年08月04日. Archived from the original on 2012年04月19日. Retrieved 2011年05月14日.
  11. ^ "Google Body – Google Labs". Bodybrowser.googlelabs.com. Archived from the original on 2011年05月13日. Retrieved 2011年05月14日.
  12. ^ Bhanoo, Sindya N. (2010年12月23日). "New From Google: The Body Browser". Well.blogs.nytimes.com. Retrieved 2011年05月14日.
  13. ^ "AUTODESK FUSION 360: THE FUTURE OF CAD, PT. 1". 3dcadworld.com. 29 November 2012. Retrieved 2013年08月21日.
  14. ^ "WebGL 2 Specification". khronos.org. 2013年09月26日. Retrieved 2013年10月28日.
  15. ^ "WebGL 2.0 Specification".
  16. ^ "WebGL - Web APIs". MDN. 28 September 2024.
  17. ^ a b "ANGLE - Almost Native Graphics Layer Engine". 2019. Retrieved June 21, 2019.
  18. ^ "WebGL test page". webgl.org.
  19. ^ "WebGL Report". webglreport.com.
  20. ^ "WebGL Browser Report — WebGL Detection — WebGL Tester — BrowserLeaks". browserleaks.com.
  21. ^ Mah, Paul (February 8, 2011). "Google releases Chrome 9; comes with Google Instant, WebGL – FierceCIO:TechWatch". FierceCIO. Archived from the original on 2011年10月25日. Retrieved 2012年03月20日.
  22. ^ "WebGL in Chrome Stable! - Learning WebGL". learningwebgl.com. Archived from the original on 2015年05月28日. Retrieved 2014年08月07日.
  23. ^ a b c "(WebGL) How to Enable Native OpenGL in your Browser (Windows)". geeks3d.com. 11 June 2013.
  24. ^ "Chromium Blog: Introducing the ANGLE Project". Chromium Blog.
  25. ^ a b "WebGL around the 2013年10月17日 - Learning WebGL". learningwebgl.com. Archived from the original on 8 August 2014. Retrieved 5 August 2014.
  26. ^ "At last! Chrome D3D11 day has come!". tojicode.com.
  27. ^ "Mozilla Firefox 4 Release Notes". Mozilla.com. 2011年03月22日. Retrieved 2012年03月20日.
  28. ^ "New in OS X Lion: Safari 5.1 brings WebGL, Do Not Track and more". Fairerplatform.com. 2011年05月03日. Archived from the original on 2012年03月19日. Retrieved 2012年03月20日.
  29. ^ "Enable WebGL in Safari". Ikriz.nl. 2011年08月23日. Archived from the original on 2012年03月04日. Retrieved 2012年03月20日.
  30. ^ "Getting a WebGL Implementation". Khronos.org. 2012年01月13日. Retrieved 2012年03月20日.
  31. ^ "Implementations/WebKit". Khronos.org. 2011年09月03日. Retrieved 2012年03月20日.
  32. ^ "WebGL Now Available in WebKit Nightlies". Webkit.org. Archived from the original on 2012年03月08日. Retrieved 2012年03月20日.
  33. ^ modeless (2021年09月24日). "Safari 15 is released. WebGL 2 is now supported in every major browser and platform!". r/webgl. Retrieved 2023年10月18日.
  34. ^ "WebGL and Hardware Acceleration". My.opera.com. 2011年02月28日. Archived from the original on 2011年03月03日. Retrieved 2012年03月20日.
  35. ^ "Introducing Opera 12 alpha". My.opera.com. 2011年10月13日. Archived from the original on 2011年10月15日. Retrieved 2012年03月20日.
  36. ^ "WebGL (Windows)". microsoft.com. Microsoft.
  37. ^ "Internet Explorer 11 Preview guide for developers". Microsoft. 2013年07月17日. Retrieved 2013年07月24日.
  38. ^ "WebGL". Microsoft. 2013年07月17日. Retrieved 2013年07月24日.
  39. ^ "Internet Explorer 11 to support WebGL and MPEG Dash". Engadget. 2013年06月26日. Retrieved 2013年06月26日.
  40. ^ "IE11 fails more than half tests in official WebGL conformance test suite". Microsoft Connect.
  41. ^ "IEWebGL". Iewebgl. Retrieved 2014年08月14日.
  42. ^ "GitHub - Microsoft Edge WebGL Implementation". Microsoft. 2016年06月04日. Retrieved 2016年06月10日.
  43. ^ "WebGL: 2D and 3D graphics for the web - Web APIs - MDN" . Retrieved 2023年06月28日.
  44. ^ a b "WebGL 2.0 - Can I use..." Retrieved 2023年06月28日.
  45. ^ "Chrome for Android and Webview" . Retrieved 2025年06月09日.
  46. ^ McDonough, Larry. "WebGL: 3D Gaming on the Web Arrives". BerryReview. Archived from the original on 2013年04月13日. Retrieved 2013年04月09日.
  47. ^ Halevy, Ronen. "PlayBook OS 2.0 Developer Beta Includes WebGL, Flash 11, & AIR 3.0". BerryReview. Retrieved 2011年11月15日.
  48. ^ "WebGL on Mobile Devices". iChemLabs. 2011年11月12日. Archived from the original on 2013年01月27日. Retrieved 2011年11月25日.
  49. ^ a b c "Mobile HTML5 compatibility on iPhone, Android, Windows Phone, BlackBerry, Firefox OS and other mobile devices" . Retrieved 2015年09月16日.
  50. ^ Voipio, Riku (2010年06月07日). "WebGL on N900". Suihkulokki.blogspot.com. Retrieved 2011年05月14日.
  51. ^ "Dev guide: WebGL – Microsoft Edge Development". Microsoft. Archived from the original on 2016年10月08日. Retrieved 2016年06月10日.
  52. ^ "Opera Mobile 12". Opera Software. Archived from the original on 1 March 2012. Retrieved 27 February 2012.
  53. ^ Cunningham, Andrew (2014年09月17日). "iOS 8, Thoroughly Reviewed". Ars Technica. Retrieved 2014年09月19日.
  54. ^ "HTML5test – How well does your browser support HTML5?" . Retrieved 2015年09月16日.
  55. ^ "HTML5test – How well does your browser support HTML5?" . Retrieved 2015年09月16日.
  56. ^ Parisi, Tony (13 February 2014). Programming 3D Applications with HTML5 and WebGL: 3D Animation and Visualization for Web Pages. "O'Reilly Media, Inc.". pp. 364–366. ISBN 978-1-4493-6395-6.
  57. ^ Barrett, Stephen. "Tegra K1 Lands in Acer's Newest Chromebook". anandtech.com. Archived from the original on August 11, 2014.
  58. ^ "Blog > Away3D Typescript 4.1 Alpha > Away3D". away3d.com. Archived from the original on 2014年08月08日. Retrieved 2014年08月05日.
  59. ^ a b Boreskov, Alexey; Shikin, Evgeniy (2014). Computer Graphics: From Pixels to Programmable Graphics Hardware. CRC Press. p. 370. ISBN 978-1-4398-6730-3.
  60. ^ Anyuru, Andreas (2012). Professional WebGL Programming: Developing 3D Graphics for the Web. John Wiley & Sons. p. 140. ISBN 978-1-119-94059-3.
  61. ^ Fulton, Steve; Fulton, Jeff (2013). HTML5 Canvas (2nd ed.). "O'Reilly Media, Inc.". p. 624. ISBN 978-1-4493-3588-5.
  62. ^ a b "The WebGL potential - TypedArray.org". typedarray.org.
  63. ^ "Blend4Web Official Site - About". Blend4Web.com. Retrieved 2015年06月22日.
  64. ^ "Live editing WebGL shaders with Firefox Developer Tools". Mozilla Hacks – the Web developer blog.
  65. ^ "Real-Time Rendering · WebGL Debugging and Profiling Tools". realtimerendering.com. 19 November 2013.
[edit ]
Features, standards & protocols
Features
Web standards
Protocols
Active
Blink-based
Proprietary
FOSS
Gecko-based
Goanna-based
WebKit-based
Multi-engine
Other
Discontinued
Blink-based
Gecko-based
MSHTML-based
WebKit-based
Other
Protocols
Server APIs
Apache modules
Topics
Browser APIs
Web APIs
WHATWG
W3C
Khronos
Others
Topics

AltStyle によって変換されたページ (->オリジナル) /