绘制分层 OpenGL ES 内容的最佳方式是什么?

发布于 2024-08-04 05:08:30 字数 263 浏览 3 评论 0原文

有人知道在 iPhone 上绘制多层 2D OpenGL ES 内容的最佳实践是什么吗?

例如,假设我想绘制一个复杂的全屏背景纹理,然后是一个旋转纹理,最后是顶部的另一个 alpha 混合纹理。

有没有办法只绘制一次背景纹理,并且只在必要时绘制对上层的更改?

到目前为止我发现的所有内容都表明您应该始终使用 glClear(),然后以正确的顺序绘制所有内容,每一帧,每个刻度。但是,如果某个东西不发生变化,每秒绘制 60 次就没有意义了……

谢谢!

Anyone know what the best practices are for drawing multiple layers of 2D OpenGL ES content on the iPhone?

For example, let's say I want to draw a complex fullscreen background texture, followed by a rotating texture, followed by another alpha blended texture on top.

Is there a way to draw the background texture only ONCE, and only draw changes to the upper layers when necessary?

Everything I've found so far indicates that you should always glClear(), then draw everything, every frame, every tick, in the proper order. But there's no sense in drawing something 60 times a second if it doesn't change...

Thanks!

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

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

发布评论

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

评论(1

儭儭莪哋寶赑 2024-08-11 05:08:30

如果您的绘图要覆盖每个像素(并且您没有与透明颜色进行 alpha 混合),则不必使用 glClear()。 (您不必绘制看不到的内容。)

但是,在大多数情况下,您需要每帧绘制背景。如果您的动画仅发生在比屏幕更小的矩形中(其余部分保持静态),您可能只能重绘该矩形,但这可能比它的价值更麻烦。

是什么让你的背景纹理变得复杂?它只是大(512x512)吗?

You don't have to glClear() if your drawing is going to cover every pixel (and you aren't alpha blending with the clear color). (You don't have to draw what you can't see.)

However in most cases you'll need to draw the background every frame. If your animation takes place only in a smaller rectangle than the screen (and the rest stays static) you could perhaps only redraw that rectangle, but that's probably more trouble than it's worth.

What makes your background texture, complex? Is it just large (512x512)?

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