OpenGL ES/ iPhone 开发问题 - 第一款游戏
我目前正在使用 openGLES 开发我的第一个 iPhone 游戏 - 太棒了!热爱它的每一分钟。不过我有几个问题:
我想制作一个粒子系统 - 最快的方法是什么?我想我可以创建一个可变的粒子对象数组,但是每个粒子都必须从 NSObject 派生,对吗?这似乎带来了相当大的开销..有更好的方法吗?过去,在 C++ 中,我使用了极其简单的粒子对象的向量,并将死粒子交换到末尾,并在需要新粒子时重用它们 - 我可能会在这里做同样的事情。只是担心(也许不公正)效率。
如何更改 OpenGL 的坐标系,以允许我使用 0 屏幕尺寸作为单位,而不是默认的 -1 到 1? (例如,使用点 {-1,0,0, 1,0,0, 0,1,0} 的简单顶点列表将形成一个三角形,其中斜边沿整个中心水平轴延伸)< /p>
- < 我根本无法在 1.1 中使用着色器,但是 2.0 将它们用于一切我有什么理由坚持使用 1.1 吗?
有充分的理由完全用 OpenGL 创建 GUI 吗?或者我可以很好地使用标准系统吗? (例如使用 GUI 元素创建 xib 文件)
由于我刚刚开始,OpenGL ES 是否存在通常伴随的常见陷阱?我并不是真的希望这是一个开放式的,我试图根除任何使该规范的许多新用户绊倒的具体内容。
I'm currently working on my first iPhone game with openGLES- it is amazing! Loving every minute of it. However I have a couple questions:
I would like to make a particle system- what is the fastest way to do this? I would imagine that I could just make a mutable array of particle objects, however each particle would then have to be derived from NSObject, correct? This seems like it comes with quite a bit of overhead.. Is there a better way? In the past, with c++ I've used a vector of extremely simple particle objects, and swapped the dead particles to the end, and reuse those when I need a new particle- I'll likely do the same here. Just worried (perhaps unjustly) about efficiency.
How do I change the coordinate system of OpenGL to allow me to use 0-screensize as units instead of the default -1 to 1? (for instance, a simple vertex list using the points {-1,0,0, 1,0,0, 0,1,0} would make a triangle in which the hypotenuse stretched along the entirety of the center horizontal axis)
It looks as though I can't use shaders at all with 1.1, but 2.0 utilizes them for everything is there any reason for me to stick with 1.1?
Is there good reason to create my GUI completely in OpenGL? Or would I be well served to use the standard system? (such as creating a xib file with GUI elements)
Since I'm just beginning are there any common pitfalls that typically accompany OpenGL ES? I don't really intend this to be open-ended, I'm attempting to root out anything concrete that trips up a lot of new users of the specification.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这样的东西会给你一个 480x320 坐标系:
祝你好运,让它成为一个有趣的游戏:-)
Something like this will get you a 480x320 coordinate system:
Good luck, make it a fun game :-)