as3 的 OpenGL 风格堆栈库
我目前正在 AS3 中开发 3D 引擎,我为即将推出的新 Molehill API 设计了它,但我也想渲染到当前的 AS3 图形 API。我想我会编写一个基于堆栈的实现来渲染到目标 DisplayObject。然后我意识到我基本上可以创建一个 OpenGL API 风格的接口来从实际的光栅化过程中抽象出我的 3D 引擎。 (就像任何基于 OpenGL 构建的 3D 引擎一样)这也将允许其他 3D 引擎像使用任何其他导入库一样使用该代码。显然会有处理视口、矩阵堆栈等的功能,但我举一个简单的例子:
AS3GL.begin( AS3GL.GL_TRIANGLES );
AS3GL.color3f(1,0,0);
AS3GL.vertex2f(0,0);
AS3GL.color3f(0,1,0);
AS3GL.vertex2f(.5,0);
AS3GL.color3f(0,0,1);
AS3GL.vertex2f(.5,.5);
AS3GL.end();
我想知道 AS3 是否已经存在我可以使用的类似功能,或者是否有人有关于内部状态系统和/或的详细信息OpenGL 的堆栈实现。
I am currently working on a 3D engine in AS3, I have designed it for the new upcoming Molehill API but I also want to render to the current AS3 graphics API. I thought that I would write a stack based implementation to render to the target DisplayObject. I then realised that I could essentially create an OpenGL API style interface to abstract my 3D engine from the actual rasterizing processes. (Just like any 3D engine built on OpenGL) This would also then allow other 3D engines to make use of the code as with any other imported library. Obviously there would be functionality handling the viewport, matrix stack etc, but a simple example my be:
AS3GL.begin( AS3GL.GL_TRIANGLES );
AS3GL.color3f(1,0,0);
AS3GL.vertex2f(0,0);
AS3GL.color3f(0,1,0);
AS3GL.vertex2f(.5,0);
AS3GL.color3f(0,0,1);
AS3GL.vertex2f(.5,.5);
AS3GL.end();
I wondered if anything like this already exists for AS3 that I could use, or if anyone has any detailed information about the inner state systems and/or stack implementations of OpenGL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Adobe鼹鼠在这里。你想做的事情是很有可能的。您应该从阅读旧的 OpenGL 规范开始。但是,请考虑一下您真正想做的事情以及原因。作为一项教育练习,将 70 年代的技术映射到现代 API 是非常棒的。如果你想做一个有用的库或者学习现代 3d,这是一个死胡同。 Molehill API 的一大优点是它在脚本语言和 GPU 之间实现了正确的平衡:使用脚本批处理大块的三角形绘制。对每个顶点进行多次调用会破坏该模型。
Adobe Mole here. What you want to do is very possible. You should start with reading old OpenGL specs. However please consider what you really want to do and why. As an educational exercise it is great to map tech from the 70s to a modern API. If you want to do a useful library or learn modern 3d, this is a dead end. One great thing about the Molehill API is that it does the right balance between a scripting language and GPUs: Use script to batch big chunks of triangle drawing. Doing multiple calls for every single vertex defeats that model.
我决定自己开始这个项目,如果有人愿意贡献,请与我联系。我已经注册了网站 AS3GL.com 并为此设置了一个谷歌代码存储库。如果有人能够发送有关 OpenGL 堆栈和内部工作原理的信息,我将不胜感激。
[编辑]
该库已停产,但这里是 GitHub 存储库,供参考“开发分支”https: //github.com/Zest3D/as3gl/tree/dev
I have decided to start this as a project myself, if anyone wishes to contribute please contact me. I have registered the site AS3GL.com and setup a google code repo ready for this. If anyone is able to send info about the stacks and inner workings of OpenGL, I would appreciate any info.
[EDIT]
This library became discontinued, but here is the GitHub repo for reference 'dev branch' https://github.com/Zest3D/as3gl/tree/dev