我应该如何组织 OpenGL ES 1.x 2D 图层树?

发布于 2024-08-19 10:49:22 字数 1142 浏览 3 评论 0原文

我正在开发一个可爱的拼图应用程序 - http://gotoandplay.freeblog.hu/categories/compactTangram< /a>/ - ,出于性能原因,我决定使用 OpenGL 渲染视图。我开始学习它,我可以以非常基本的方式处理缓冲区、顶点、纹理。

情况: 在游戏中,用户操纵 7 个拼图块,每个拼图块有 5 个子层,以获得一些漂亮的灯光感觉。大多数纹理都是 256x256。用户一次只能操作一个棋子,因此在游戏过程中其余部分保持不变。此处没有任何图形的应用程序框架:http://gotoandplay。 freeblog.hu/archives/2009/11/11/compactTangram_v10_-_puzzle_completement_test/

问题: 我应该如何组织它们?在单独的帧缓冲区(?)/纹理(?)中“预绘制”实际的块状态是一个好主意,还是我可以简单地在一个时间步长中重新绘制每个块/层(1 + 7 * 5 = 36 sprite)?如果我使用“predraw”,那么我该怎么办?绘制到 puzzePiece 帧缓冲区?那么如何将其绘制到场景帧缓冲区中呢?或者是否有更简单的方法来“合并”纹理?

希望你能理解我的问题,如果它看起来太暗淡,请看看我的博客中关于如何渲染实际作品的想法(有我要做的事情的简单闪存实现)在这里: http ://gotoandplay.freeblog.hu/archives/2010/01/07/compactTangram_072_-_tan_rendering_labs/

I'm developing a cute puzzle app - http://gotoandplay.freeblog.hu/categories/compactTangram/ - , and for performance reasons I decided to render the view with OpenGL. I started to learning it, I'm ok with buffers, vertices, textures in a really basic way.

The situation:
In the game user manipulates 7 puzzlePiece, each has 5 sublayers to get some pretty lighting feel. Most of the textures are 256x256. The user manipulates only one piece at a time, so the rest is unchanged during play. A skeleton of app without any graphic here: http://gotoandplay.freeblog.hu/archives/2009/11/11/compactTangram_v10_-_puzzle_completement_test/

The question:
How should I organize them? Is it a good idea to "predraw" the actual piece states in separate framebuffers(?)/textures(?) or I can simply redraw every piece/layers (1+7*5=36 sprite) in a timestep? If I use "predraw", then what should I do? Drawing to a puzzePiece framebuffer? Then how can I draw it into the scene framebuffer? Or is there a simplier way to "merge" textures?

Hope you can understand my question, if it seems too dim please take a look at my idea on how render an actual piece in my blog (there is a simple flash implemetation of what I'm gonna do) here: http://gotoandplay.freeblog.hu/archives/2010/01/07/compactTangram_072_-_tan_rendering_labs/

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

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

发布评论

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

评论(1

追我者格杀勿论 2024-08-26 10:49:22

处理纹理的常见方法是在游戏/关卡开始时将所有图像打包到“纹理图集”中。

最大纹理尺寸为 1024x1024,iPhone 内存中大约可以容纳三个纹理。

当您拥有这些“超级纹理”中的所有图像时,您可以只绘制大纹理的相关区域。这样做的优点是,您可以减少绑定纹理的次数,从而获得更好的性能,并且可以消除因需要将小图像放入二次方大小的纹理而占用的任何多余空间。

A common way of handling textures is to pack all your images into a 'texture atlas' at the start of the game/level.

Your maximum texture size is 1024x1024 and you can have about three of them in memory on the iPhone.

When you have all the images in these 'super textures' you can just draw the relevant area of the large texture. This has the advantage that you have to bind textures less often and you gain better performance, as well as cutting out any excess space used by the necessity to put small images in power-of-two size textures.

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