WebGL

Web浏览器中opengl的JavaScript绑定

WebGL是一种JavaScript API,用于在不使用插件的情况下在任何兼容的网页浏览器中呈现交互式2D和3D图形[3]。WebGL完全集成到浏览器的所有网页标准中,可将影像处理和效果的GPU加速使用方式当做网页Canvas的一部分。WebGL元素可以加入其他HTML元素之中并与网页或网页背景的其他部分混合[4]。WebGL程序由JavaScript编写的句柄和OpenGL Shading Language(GLSL)编写的着色器代码组成,该语言类似于CC++,并在电脑的图形处理器(GPU)上执行。WebGL由非营利Khronos Group设计和维护[5]

WebGL
原作者Mozilla基金会
开发者WebGL Working Group
首次发布2011年3月3日 (2011-03-03)[1]
当前版本
  • 2.0 (2017年1月17日;稳定版本)[2]
编辑维基数据链接
操作系统跨平台
类型API
网站www.khronos.org/webgl/

设计 编辑

WebGL 1.0基于OpenGL ES 2.0,并提供了3D图形的API[6]。它使用HTML5 Canvas并允许利用文档对象模型接口。WebGL 2.0基于OpenGL ES 3.0,确保了提供许多选择性的WebGL 1.0扩展,并引入新的API[7]。可利用部分Javascript实现自动存储器管理[5]

历史 编辑

WebGL起源于Mozilla员工弗拉基米尔·弗基西维奇一项称为Canvas 3D的实验项目。2006年,弗基西维奇首次展示了Canvas 3D的原型。2007年底在Firefox[8]和Opera[9]被实现。

在2009年初,非营利技术联盟Khronos Group启动了WebGL的工作组,最初的工作成员包括AppleGoogleMozillaOpera[5][10]。2011年3月发布WebGL 1.0规范[1]。截至2012年3月,工作组的主席由肯·罗素(Ken Russell,全名“Kenneth Bradley Russell”)担任。

WebGL的早期应用包括Zygote Body[11][12]

WebGL 2规范的发展始于2013年,并于2017年1月完成[13]。该规范基于OpenGL ES 3.0[14]。首度实现在Firefox 51、Chrome 56和Opera 43中[15]

支持 编辑

目前,WebGL在最新的浏览器中被广泛支持。然而,其可用性取决于其他因素,如GPU支持。WebGL官方网站提供了一个简单的测试页[16]。而第三方网站提供了更详细的消息(如浏览器使用的渲染器以及可用的扩展)[17][18]

桌面浏览器 编辑

  • Google Chrome – 从9.0开始支持默认激活了 WebGL [19][20]。在Windows上,默认情况下,Chrome使用ANGLE渲染器将OpenGL ES转换为Direct X 9.0c或11.0,后者具有更好的驱动程序支持[21]。在Linux和Mac OS X上,默认渲染器是OpenGL[22],也可以强制OpenGL作为Windows上的渲染器[21]。2013年9月起,Chrome还推出了更新的Direct3D 11渲染器,但需要更新的显卡[23][24]。 Chrome 56+支持WebGL 2.0。
  • Internet Explorer – 从11开始支持[25]。Internet Explorer 11 最初未能通过大多数官方的WebGL一致性测试,但微软后来发布了几个更新,最新的0.94 WebGL引擎目前通过了约97%的Khronos测试。较旧的版本可以安装第三方插件来支持,如IEWebGL[26]
  • Mozilla Firefox – 从4.0开始支持默认激活[27]。Firefox也通过ANGLE在Windows平台上使用DirectX。Firefox 51+ 支持 WebGL 2.0。
  • Safari – 在Mac OS X Snow Leopard上的Safari 5.1、OS X Mountain LionMac OS X Lion上的Safari6.0或较新版本开始支持WebGL,默认情况下禁用[28][29][30][31][32]。Safari版本12(在MacOS Mojave中可用)支持WebGL 2.0,目前作为"实验性"功能。
  • Opera – 需自行激活[33][34]。Opera 43+支持WebGL 2.0
  • Microsoft Edge – 对于Microsoft Edge Legacy,初始稳定版本支持WebGL版本0.95(context名称:"experimental-webgl"),并带有开源GLSL到HLSL转译器。 版本 10240+ 支持以 WebGL 1.0 为前缀。最新的基于Chromium的Edge支持WebGL 2.0

移动浏览器 编辑

参考文献 编辑

  1. ^ 1.0 1.1 Khronos Releases Final WebGL 1.0 Specification. [2015-05-18]. (原始内容存档于2016-11-08). 
  2. ^ https://www.khronos.org/registry/webgl/specs/.
  3. ^ Gregg Tavares. WebGL Fundamentals. HTML5 Rocks. 2012-02-09 [2015-12-27]. (原始内容存档于2022-02-08). 
  4. ^ Parisi, Tony. WebGL: Up and Running. O'Reilly Media, Incorporated. 2012-08-15 [2017-06-11]. (原始内容存档于2013-02-01). 
  5. ^ 5.0 5.1 5.2 WebGL - OpenGL ES 2.0 for the Web
  6. ^ WebGL Specification. Khronos.org. [2011-05-14]. (原始内容存档于2012-04-12). 
  7. ^ WebGL 2.0 Specification. Khronos.org. [2017-02-27]. (原始内容存档于2017-01-28). 
  8. ^ Canvas 3D: GL power, web-style. Blog.vlad1.com. [2011-05-14]. (原始内容存档于2011-07-17). 
  9. ^ Taking the canvas to another dimension. My.opera.com. 2007-11-26 [2011-05-14]. (原始内容存档于2007-11-17). 
  10. ^ Khronos Details WebGL Initiative to Bring Hardware-Accelerated 3D Graphics to the Internet. Khronos.org. 2009-08-04 [2011-05-14]. (原始内容存档于2012-04-12). 
  11. ^ Google Body – Google Labs. Bodybrowser.googlelabs.com. [2011-05-14]. (原始内容存档于2011-05-13). 
  12. ^ Bhanoo, Sindya N. New From Google: The Body Browser. Well.blogs.nytimes.com. 2010-12-23 [2011-05-14]. (原始内容存档于2015-02-06). 
  13. ^ WebGL 2 Specification. khronos.org. 2013-09-26 [2013-10-28]. (原始内容存档于2017-08-08). 
  14. ^ 存档副本. [2017-06-11]. (原始内容存档于2017-01-28). 
  15. ^ 存档副本. [2017-06-11]. (原始内容存档于2017-08-28). 
  16. ^ WebGL test page. webgl.org. [2015-12-27]. (原始内容存档于2015-04-18). 
  17. ^ WebGL Report. webglreport.com. [2017-06-11]. (原始内容存档于2015-05-28). 
  18. ^ WebGL Browser Report — WebGL Detection — WebGL Tester — BrowserLeaks. browserleaks.com. [2017-06-11]. (原始内容存档于2015-05-20). 
  19. ^ Paul Mah. Google releases Chrome 9; comes with Google Instant, WebGL – FierceCIO:TechWatch. FierceCIO. February 8, 2011 [2012-03-20]. (原始内容存档于2011-10-25). 
  20. ^ WebGL in Chrome Stable! - Learning WebGL. learningwebgl.com. [2015-12-27]. (原始内容存档于2015-05-28). 
  21. ^ 21.0 21.1 (WebGL) How to Enable Native OpenGL in your Browser (Windows) | Geeks3D. [2022-03-24]. (原始内容存档于2022-04-17) (美国英语). 
  22. ^ Introducing the ANGLE Project. Chromium Blog. [2022-03-24]. (原始内容存档于2022-04-22) (英语). 
  23. ^ WebGL around the net, 17 Oct 2013 | Learning WebGL. web.archive.org. 2014-08-08 [2022-03-24]. 原始内容存档于2014-08-08. 
  24. ^ Brandon Jones. At last! Chrome D3D11 day has come!. [2022-03-24]. (原始内容存档于2022-04-19) (英语). 
  25. ^ WebGL (Windows). 微软. [2014-03-05]. (原始内容存档于2015-03-24). 
  26. ^ IEWebGL. Iewebgl. [2014-08-14]. (原始内容存档于2022-02-08). 
  27. ^ Mozilla Firefox 4 Release Notes. Mozilla.com. 2011-03-22 [2012-03-20]. (原始内容存档于2011-03-23). 
  28. ^ New in OS X Lion: Safari 5.1 brings WebGL, Do Not Track and more. Fairerplatform.com. 2011-05-03 [2012-03-20]. (原始内容存档于2012-03-19). 
  29. ^ Enable WebGL in Safari. Ikriz.nl. 2011-08-23 [2012-03-20]. (原始内容存档于2012-03-04). 
  30. ^ Getting a WebGL Implementation. Khronos.org. 2012-01-13 [2012-03-20]. (原始内容存档于2015-05-28). 
  31. ^ Implementations/WebKit. Khronos.org. 2011-09-03 [2012-03-20]. (原始内容存档于2015-03-21). 
  32. ^ WebGL Now Available in WebKit Nightlies. Webkit.org. [2012-03-20]. (原始内容存档于2012-03-08). 
  33. ^ WebGL and Hardware Acceleration. My.opera.com. 2011-02-28 [2012-03-20]. (原始内容存档于2011-03-03). 
  34. ^ Introducing Opera 12 alpha. My.opera.com. 2011-10-13 [2012-03-20]. (原始内容存档于2011-10-15). 
  35. ^ 35.0 35.1 Mobile HTML5 compatibility on iPhone, Android, Windows Phone, BlackBerry, Firefox OS and other mobile devices. [2015-09-16]. (原始内容存档于2022-04-15). 
  36. ^ iclkevin. WebGL on Mobile Devices. iChemLabs. 2011-11-12 [2011-11-25]. (原始内容存档于2013-03-12). 
  37. ^ Kersey, Jason. Chrome Beta for Android Update. Chrome Releases Blog. Google. [2013-08-23]. (原始内容存档于2015-04-03). 
  38. ^ Opera Mobile 12. Opera Software. [27 February 2012]. (原始内容存档于2012年3月1日). 
  39. ^ HTML5test - How well does your browser support HTML5?. [2015-09-16]. (原始内容存档于2022-04-15). 
  40. ^ Cunningham, Andrew. iOS 8, Thoroughly Reviewed. Ars Technica. 2014-09-17 [2014-09-19]. (原始内容存档于2014-09-20). 

外部链接 编辑

参见 编辑