绘制分层 OpenGL ES 内容的最佳方式是什么?
有人知道在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的绘图要覆盖每个像素(并且您没有与透明颜色进行 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)?