I'm looking to do a 3-d orbiter, thus, I obviously need perspective views, camera movement, etc. I also need to be able to apply textures to the geometry. Given the complexity, I don't see this happening in anything other than <canvas>
or flash.
As I understand it, <canvas>
is limited to 2d, but you can do all of the 3d work with JS and simply output the 2d projection into the canvas. My understanding stops right about there, and figuring all of this out seems rather complicated.
Question #1: What 3d graphics libraries are out there that offer the basic features that I need (3d->2d perspective projections, textures, anima开发者_运维知识库tion of the camera, and fluid user input that pans, zooms, tilts, dollies, etc. the camera)?
Question #2: Out of the non-proprietary libraries that offer this type of functionality that I've been able to find on my own (three.js and C3DL,) they all appear to require webGL. Is webGL pretty much required for this type of thing, or is support for <canvas>
sufficient? If webGL isn't required, is there any reason to use it if I'm not making anything that would bog down the CPU?
Note: I'm going to go ahead and try to learn three.js to get this done unless someone advises otherwise.
First off, Canvas is in no way "limited" to 2D. There is a 2D context and if you really want you can make 3D scenes with it (see below). As you say, there is additionally the WebGL context for 3D rendering that uses a different spec.
To answer #2, WebGL is in no way a requirement. For instance this library projects 3D using only the 2D canvas context:
http://arc.id.au/Canvas3DGraphics.html
There are also several examples of projective texturing/rotating objects, such as:
http://acko.net/files/projective/index.html
To answer #1, there is the library linked above, but its really the only one I've seen that uses the 2D context.
精彩评论