如何在 openGL 中创建 Wolf 3D 类型的基本 3D 墙
我试图弄清楚如何在 openGL 中创建像这样的简单 3D 墙。我不想创建任何花哨的东西,只是一个基本的 3D 墙,我可以在其中向前和向后移动,将其想象为只有地图、没有杀戮的 Wolf 3D 游戏。
有没有任何框架可以用来执行此操作?我想在 openGL 中完成它,以便我可以在我的 iPhone 上创建/渲染这个东西。
谢谢 普拉奈 如果有人可以向我指出一些示例源代码,那将会很有帮助。
I was trying to figure out how I can create simple 3D walls like this in openGL. I dont want to create any fancy stuff just a basic 3D wall where i can move fwd and backwards imagine it as Wolf 3D game with only map no killing etc.
Is there any framework which I can use to do this?? I want to do it in openGL so that I can create/render this thing on my iphone.
Thanks
Pranay
If any body can point me to some sample source code it will be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
作为非 OpenGL 替代方案,您可以构建这样的迷宫并仅使用核心动画在其中移动。带纹理的墙段将是 CALayers,其中包含经过 3D 转换以面向适当方向的图像。迷宫可以相对于相机平移,以使用户移动穿过该区域。此代码将比从头编写的等效 OpenGL ES 实现简单得多。
John Blackburn 在他的文章此处中提供了一个示例。
As a non-OpenGL alternative, you can construct such a maze and move through it using only Core Animation. The textured wall segments would be CALayers containing images that had been transformed in 3-D to face the appropriate directions. The maze could be translated relative to the camera to cause the user to move through the area. The code for this would be significantly simpler than an equivalent OpenGL ES implementation written from scratch.
An example of this is presented by John Blackburn in his article here.
如果你想使用OpenGL,那么你必须自己创建一切。但有几个不错的 3D 引擎。
免费:
oolongengine,
Ogre iPhone
已付费(但非常强大):
Shiva3D,
Unity3D
If you want to use OpenGL, then you have to create everything yourself. But there are several nice 3D engines.
Free:
oolongengine,
Ogre iPhone
Payed (but very powerful):
Shiva3D,
Unity3D
从头开始在 3D 空间中创建漫游并不是简单的事情。这实际上涉及很多数学。
您将从世界的 3D 模型开始,为了将自己置于观看者的视角,您必须通过一系列变换来变换此 3D 模型:
每个变换都将被定义为 4x4 矩阵。希望这对您有所帮助。
Creating a walk-throug in a 3D space from scratch, isn't basic stuff. It's actually a lot of math.
You will start with the 3D model of the world and in order to put yourself in the perspective of the viewer you have to transform this 3D model with a series of transformations:
Each of those transformations will be defined as a 4x4 matrix. Hope this helps you for a start.