跨浏览器的WebGL扩展支持

时间:2013-07-04 18:51:04

标签: webgl webgl-extensions

这可能就像我在Chrome或Firefox中的愚蠢设置一样简单,但我只是不知道该去哪里弄清楚它是否是那个或者是否是别的东西。

我想弄清楚的基本原因是为什么浏览器之间的扩展支持是如此不同。

例如,转到http://prideout.net/recipes/ExtensionViewer.html

对于FireFox,我得到了

OES_texture_float (google) (registry)
OES_standard_derivatives (google) (registry)
EXT_texture_filter_anisotropic (google) (registry)
MOZ_WEBGL_lose_context (google) (registry)
WEBGL_lose_context (google) (registry)
MOZ_WEBGL_compressed_texture_s3tc (google) (registry)
WEBGL_compressed_texture_s3tc (google) (registry)

但是在Chrome中我得到了:

OES_standard_derivatives (google) (registry)
WEBKIT_EXT_texture_filter_anisotropic (google) (registry)
OES_vertex_array_object (google) (registry)
OES_element_index_uint (google) (registry)
WEBGL_lose_context (google) (registry)

请注意缺少的OES_texture_float

我在某些时候注意到我(或者确实)似乎有一个AMD相关的浮点扩展名,但我不知道哪个页面显示我有这个。我有一种感觉,无论展示它是旧版Chrome。

我知道我的卡支持浮点纹理(至少在某种程度上),每当我去Firefox中需要浮点纹理的页面时,该演示工作得非常好。

如果有什么我想弄清楚的,那就是我要做的就是让浮点纹理在我的机器上的Chrome中运行。您可以使用WebGL执行的一些最酷的事情需要使用浮点纹理扩展。

据我所知,Firefox和Chrome都使用ANGLE,所以不会同时支持相同的扩展程序吗?

3 个答案:

答案 0 :(得分:3)

从MDN的WebGL best practices page阅读:

  • 即使支持,也可能不支持渲染到浮点纹理 支持OES_texture_float扩展。通常,这会失败 在当前的移动硬件上。要检查是否支持此功能,您需要 调用WebGL checkFramebufferStatus()函数。

这是一个硬件问题,至少应该在现代专用图形卡上工作,但是对于平板电脑和手机等“弱”设备,你需要一些解决方法或后备。

答案 1 :(得分:3)

要获得平台上支持的扩展程序列表,请使用

var extensions = gl.getSupportedExtensions();

它返回一个字符串数组。该阵列取决于许多因素:

  • 您拥有的硬件和驱动程序
  • 浏览器(Firefox / Chrome /其他)
  • 浏览器的一个版本
  • 您请求的WebGL上下文版本(目前为1或2)

在英特尔Iris Graphics 6100的2015年mac book pro上,我今天(16.05.2017)

来自Chrome的26个传播WebGL 1.0扩展程序:

[
  'ANGLE_instanced_arrays',
  'EXT_blend_minmax',
  'EXT_disjoint_timer_query',
  'EXT_frag_depth',
  'EXT_shader_texture_lod',
  'EXT_sRGB',
  'EXT_texture_filter_anisotropic',
  'WEBKIT_EXT_texture_filter_anisotropic',
  'OES_element_index_uint',
  'OES_standard_derivatives',
  'OES_texture_float',
  'OES_texture_float_linear',
  'OES_texture_half_float',
  'OES_texture_half_float_linear',
  'OES_vertex_array_object',
  'WEBGL_compressed_texture_s3tc',
  'WEBKIT_WEBGL_compressed_texture_s3tc',
  'WEBGL_compressed_texture_s3tc_srgb',
  'WEBKIT_WEBGL_compressed_texture_s3tc_srgb',
  'WEBGL_debug_renderer_info',
  'WEBGL_debug_shaders',
  'WEBGL_depth_texture',
  'WEBGL_draw_buffers',
  'WEBGL_lose_context',
  'WEBKIT_WEBGL_lose_context'
]
来自Firefox的23个传播WebGL 1.0扩展:

[
  'ANGLE_instanced_arrays',
  'EXT_blend_minmax',
  'EXT_color_buffer_half_float',
  'EXT_frag_depth',
  'EXT_sRGB',
  'EXT_shader_texture_lod',
  'EXT_texture_filter_anisotropic',
  'OES_element_index_uint',
  'OES_standard_derivatives',
  'OES_texture_float',
  'OES_texture_float_linear',
  'OES_texture_half_float',
  'OES_texture_half_float_linear',
  'OES_vertex_array_object',
  'WEBGL_color_buffer_float',
  'WEBGL_compressed_texture_s3tc',
  'WEBGL_debug_renderer_info',
  'WEBGL_depth_texture',
  'WEBGL_draw_buffers',
  'WEBGL_lose_context',
  'MOZ_WEBGL_lose_context',
  'MOZ_WEBGL_compressed_texture_s3tc',
  'MOZ_WEBGL_depth_texture'
]

来自Chrome的10个传播WebGL 2.0扩展程序:

[
  'EXT_color_buffer_float',
  'EXT_disjoint_timer_query_webgl2',
  'EXT_texture_filter_anisotropic',
  'OES_texture_float_linear',
  'WEBGL_compressed_texture_s3tc',
  'WEBGL_compressed_texture_s3tc_srgb',
  'WEBGL_debug_renderer_info',
  'WEBGL_debug_shaders',
  'WEBGL_get_buffer_sub_data_async',
  'WEBGL_lose_context'
]
来自Firefox的8个传播WebGL 2.0扩展:

[
  'EXT_color_buffer_float',
  'EXT_texture_filter_anisotropic',
  'EXT_disjoint_timer_query',
  'OES_texture_float_linear',
  'WEBGL_compressed_texture_s3tc',
  'WEBGL_lose_context',
  'MOZ_WEBGL_lose_context',
  'MOZ_WEBGL_compressed_texture_s3tc'
]

有关更多有用信息,请查看MDN

在这里,您可以找到非常方便的tool来检查您的浏览器。

您可以找到有关支持webgl扩展程序的全球统计信息here

check获取有关WebGL2中已升级扩展程序的信息。

答案 2 :(得分:2)

我应该保存有关我当时使用的Chrome版本的信息。截至2013-08-14(可能还有一段时间),Chrome在这台机器上

Browser: 5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36
Platform: Win32

现在支持浮点纹理。 http://prideout.net/recipes/ExtensionViewer.html提供以下内容:

WEBKIT_EXT_texture_filter_anisotropic (google) (registry)
OES_element_index_uint (google) (registry)
OES_standard_derivatives (google) (registry)
OES_texture_float (google) (registry)
OES_vertex_array_object (google) (registry)
WEBKIT_WEBGL_compressed_texture_s3tc (google) (registry)
WEBKIT_WEBGL_depth_texture (google) (registry)
WEBGL_lose_context (google) (registry)

这仍然无法解释为什么Firefox和Chrome之间存在差异,但据我所知,它可能只是ANGLE库的不同版本。

相关问题