如何在 iPhone 的 OpenGLES 中实现 sprite-sheet?

发布于 2024-08-05 20:47:28 字数 132 浏览 4 评论 0原文

我正在使用 GLSprite 示例代码示例。我想知道的是我需要对代码做什么才能让它将我的纹理视为精灵表?到目前为止,我所做的唯一修改是创建一个由 16 个较小图像组成的 256 x 256 png 作为我的框架。我以前从未使用过精灵表。感谢您的帮助。

I am working from the GLSprite sample code example. What I want to know is what do I need to do to the code to have it treat my texture as a sprite-sheet? The only modification I have done so far is to create a 256 x 256 png of 16 smaller images to be my frames. I have never worked with sprite-sheets before. Thanks for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一杆小烟枪 2024-08-12 20:47:28

您需要调整纹理坐标以映射所需的精灵。纹理坐标通常是标准化的(0 到 1)。假设您有一个 4x4 的精灵网格,第一个精灵的纹理坐标为...

0, 0
0, 0.25
0.25, 0.25
0.25, 0

You need to adjust the texture coordinates to map the required sprite. Texture coordinates are normally normalised (0 to 1). Assuming you have a 4x4 grid of sprites, the first sprite would have texture coords of...

0, 0
0, 0.25
0.25, 0.25
0.25, 0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文