我如何在OpenGLES for iPhone中实现精灵表单?(How do I implement a sprite

编程入门 行业动态 更新时间:2024-10-23 16:18:52
我如何在OpenGLES for iPhone中实现精灵表单?(How do I implement a sprite-sheet in OpenGLES for iPhone?)

我正在从GLSprite示例代码示例开始工作。 我想知道的是,我需要做些什么来让代码将我的纹理视为精灵表? 我迄今为止所做的唯一修改是创建一个256 x 256 png的16个较小的图像作为我的帧。 我从来没有使用精灵表。 谢谢你的帮助。

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.

最满意答案

您需要调整纹理坐标以映射所需的精灵。 纹理坐标通常被标准化(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

更多推荐

本文发布于:2023-07-23 12:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1231648.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   精灵   如何在   OpenGLES   sprite

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!