如何在 iPhone 上使用 OpenGL 执行补间动画之类的操作?
我对 OpenGL 和一般图形元素编程非常陌生。
目前,我有一个使用代码另一部分生成的顶点映射的纹理——这四个代表角的点每秒改变几次。在实现时,随着计时器上四个角点的改变,该图像将不稳定地“出现”在不同的位置,并且形状也不同。
我希望发生的是让对象快速移动并改变形状以占据程序给出的新点 - 我希望这种情况能够顺利发生(因此它会在这些提供的位置之间浮动/形状)。
有什么方法可以像 OpenGL 中那样进行运动/形状补间吗?如果是这样,我在哪里可以找到文档,或者更好的是示例?我很难找到或理解这种事情。
编辑:另外 - 我使用另一种方法没有问题,它不需要是 OpenGL。在核心动画中使用 BasicAnimation 可以更好地完成此操作吗?如果是这样,用于这种转变的资源在哪里?形状是四边形,但不一定是正方形或矩形,因此我需要能够指定每个角点。
I'm very new to OpenGL and programming with a graphical element in general.
Currently I have a texture that is mapped using vertices that are generated by another part of the code -- these four points that represent the corners change a few times a second. As it is implemented, this image will jerkily 'appear' in different places and shaped differently as the four corner points are altered on the timer.
What I would like to have happen is for the object to quickly move and change shape to occupy the new points given by the program -- and I would like for this to happen somewhat smoothly (so it would kind of float between these supplied positions/shapes).
Is there any way to do a kind of motion/shape tween like that in OpenGL? If so, where can I find documentation or, better yet, examples? I'm having trouble finding or understanding this kind of thing.
EDIT: ALSO - I have no problem using another method, it doesn't need to be OpenGL. Is this better done in Core Animation with BasicAnimation? If so, where are some resources for this kind of transformation? The shapes are quadrilaterals but not necessarily squares or rectangles so I would need the ability to specify each corner point.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OpenGL 不提供这样的设施。
生成顶点的代码部分,不能修改以平滑地过渡位置而不是突然改变它们吗?如果没有,您可以在该代码之上编写代码,并且您编写的代码通过平滑过渡来包装位置生成吗?
OpenGL provides no such facility.
The part of the code that generates the vertices, can't that be modified to smoothly transition the positions rather than abruptly changing them? If not, can you write code on top of that code, and that code you write wraps the position generation by smoothly transitioning?