浏览器3D的现状:没有Flash的旋转立方体?
截至 2011 年 3 月,现代浏览器(不包括 Flash)中 3D 的现状如何?
我希望能够在浏览器中显示由鼠标控制的旋转立方体。初步搜索发现 Chrome 对 WebGL 的支持,但除此之外没有明确的支持。
What is the current state of 3D in modern browsers as of March 2011, excluding Flash?
I would like to be able to display a rotating cube in my browser controlled by the mouse. An initial search finds something about Chrome support for WebGL, but no definitive support otherwise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看此示例。这就是您想要的 - 由鼠标控制的旋转立方体。它使用一个名为 Three.js 的框架,如果可用,它将使用 WebGL,但也可能会失败回到 2D HTML5 画布或 SVG,据我所知。我指出的示例使用 2d 画布。
如果您需要硬件加速 3D,那么您需要 WebGL,目前 Chrome 和 Firefox 4 Release Candidate 均支持 WebGL。但对于更简单的 3D 场景,画布和 SVG 支持应该足够了。对于不支持 WebGL 的 IE9,canvas 和 SVG 是硬件加速的。
更新: 如今,WebGL 得到了广泛的支持。即使像 IE 和 iOS Safari 这样长期坚持的浏览器在其当前版本中也支持 WebGL。
Check out this example. It's what you wanted - a rotating cube controlled by a mouse. It uses a framework called three.js, which will use WebGL if available, but can also fall back to 2D HTML5 canvas or SVG, as I understand it. The example I pointed to uses 2d canvas.
If you want hardware-accelerated 3D, then you want WebGL, which is currently supported in Chrome and the Firefox 4 Release Candidate. But for simpler 3D scenes the canvas and SVG support should be adequate. In the case of IE9, which doesn't support WebGL, canvas and SVG are hardware accelerated.
Update: These days WebGL is widely supported. Even long holdouts like IE and iOS Safari support WebGL in their current versions.
如果您不想使用 Flash(以及扩展的 Silverlight?)那么您可以查看 Quick Time。
我不知道完整的细节,但我看过允许一些用户交互的“电影”——比如改变相机位置。
如果您想要完整的交互,那么 WebGL 似乎是最佳选择,但支持有限。另外,Chrome 最近取消了对 XP 的支持(尽管它可以被覆盖) - 请参阅此超级用户问题和我的答案。唯一支持此功能的其他浏览器是 Firefox 4 和最新的 WebKit。
If you don't want to use Flash (and by extension Silverlight?) then you could look at Quick Time.
I don't know the full details but I've seen "movies" that allow some user interaction - like changing the camera position.
If you want full interaction then WebGL would seem to be the way to go, but support is limited. Also Chrome has recently pulled support from XP (though it can be overridden) - see this Super User question and my answer. The only other browsers that support this are Firefox 4 and the very latest WebKit.
如果您不介意自己进行一些 3D 计算,则可以使用 HTML5 画布在当前版本的 Chrome、Safari 和 Firefox 中绘制线条和像素。
If you don't mind doing some 3D computation yourself, you can use an HTML5 canvas for drawing lines and pixels with the current versions of Chrome, Safari and Firefox.