WebGL 框架 - 最好的选择是什么? X3DOM?
我即将启动一个将使用交互式生成的 3D 内容的 Web 应用程序。目的是让它在浏览器中原生运行,即不允许使用Flash,只能使用JavaScript + HTML5。
除了使用纯 WebGL 之外,最好使用提供更高级别接口的库。
X3DOM 的方法对我来说看起来很棒 - 看起来它应该成为浏览器中的本机,并且该库将铺平道路。
但根据我的第一印象,我不确定它是否足够轻。除了 400kb 的 JS 文件之外,它还会减慢 Firefox 的速度。
我需要的功能并不多。整个场景的设置可以通过“手工”轻松完成。但我需要用户交互,包括找出用户点击的位置。后来我希望能够以通用文件格式加载和插入 3D 对象。
PS:选择的浏览器是基于 Firefox 和 Webkit 的浏览器。桌面版和移动版。我不关心IE。
PPS:是的,我知道这个问题:WebGL Framework
I'm about to start a Web application that will use interactive generated 3D content. Aim is to let it run natively in the browser, i.e. no Flash is allowed, only JavaScript + HTML5.
Apart from using pure WebGL it's better to use a lib that will offer a more high level interface.
The approach of X3DOM looks great for me - and it looks like it's supposed to become native in the browser and the lib will pave the road.
But after my first impressions I'm not sure if it's lightweight enough. Apart from the 400kb JS-File it slows down Firefox.
The features I need are not many. The whole scene set up could be easily done by "hand". But I need user interaction including to figure out where the user clicks. And later I want to be able to load and insert 3D objects in a common file format.
PS: Browsers of choice are Firefox and Webkit based ones. Desktop and Mobile ones. I don't care about IE.
PPS: Yes, I know the question: WebGL Framework
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您有 X3D 背景(并且由伟大的人开发)时,X3DOM 非常棒,但如果您没有任何偏好,Three.JS 将是我的选择。
X3DOM is great when you come from an X3D background (and developed by great people), but if you have no preference watsoever, Three.JS would be my pick.
上周我查看了大多数 WebGL 框架,确实似乎几乎每个框架都在 300kB 范围内。这对我来说也太沉重了。幸运的是,我找到了 lightgl.js,它拥有 28kB 的 MIT 许可证,包含您入门所需的一切。
对我来说最重要的是抽象画布、着色器和纹理初始化。但 lightgl.js 也有一些鼠标处理和模型加载等。
I looked at most WebGL frameworks just last week, and it indeed seems almost every one of them is in the 300kB range. That's too heavy for me, too. Luckily I found lightgl.js which has everything you need to get started in 28kB, MIT license.
The main thing for me is just abstracting canvas, shader and texture initialization. But lightgl.js does also have some mouse handling and model loading etc.
我认为这个决定可以归结为:
你想要更多的设计或程序员方法吗?
x3dom:它利用 x3d 来描述场景,这使其成为一种更具设计性的方法,只需添加 x3dom css 和 js 就可以做到这一点:
三.js:仅允许通过 javascript 生成场景,以及许多其他功能仅需要代码来设置画布。查看这个简单框示例的源代码:http://stemkoski.github.com/Three。 js/Template.html
两种方式都没有错,我更喜欢设计场景,然后在需要进行任何计算时使用 js。
i think the decision boils down to:
do you want to have a more design or programmer approach.
x3dom: its leveraging of x3d for describing the scene lends itself to a more designer approach, with just the adding of the x3dom css and js one can do this :
three.js: only allows for scene generation through javascript, and a lot of additional code is necessary just to set up the canvas. view the source of this simple box example: http://stemkoski.github.com/Three.js/Template.html
neither way is wrong, i prefer designing the scene and then using js when needed for any computations.