The state of browser 3D: rotating cube without Flash?
What is the current state of 3D in modern browsers as of March 2011, excluding Fla开发者_Python百科sh?
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.
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.
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.
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.
精彩评论