问题描述
我正在尝试改进基于OpenGL ES的应用程序的分辨率。 Apple提到(developer.apple.com)iOS 4中的OpenGL ES支持多重采样......这可以在某种程度上改善图形。 如何启用多重采样?
I'm experimenting w/ improving the "resolution" of an OpenGL ES based app. Apple mentions here (developer.apple.com) that OpenGL ES in iOS 4 supports multisampling... and this can improve the graphics somewhat. How do you enable multisampling?
推荐答案
WWDC会话415视频有点过了,所以抓住并观察你是否可以。
The WWDC session 415 video goes over this a bit, so grab and watch that if you can.
基本上,你使用 glRenderbufferStorageMultisampleAPPLE
为msaa渲染创建第二个帧缓冲区深度和颜色缓冲。然后绑定这个多重采样帧缓冲区,渲染你的场景,然后将多重采样解析到你的主帧缓冲区:
Essentially, you create a second framebuffer for msaa rendering using glRenderbufferStorageMultisampleAPPLE
for its depth and color buffers. Then you bind this multisample framebuffer, render your scene, then do the multisampling resolve into your main framebuffer:
glBindFramebuffer(GL_READ_FRAMEBUFFER_APPLE, msaaFramebuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER_APPLE, defaultFramebuffer);
glResolveMultisampleFramebufferAPPLE();
然后绑定你的渲染缓冲区并像往常一样呈现它。
then bind your render buffer and present it as you would normally.
我自己对OpenGL ES还是比较新的,但我希望这有助于你走上正轨。
I'm still relatively new to OpenGL ES myself, but I hope this helps put you on the right track.
这篇关于如何在iPhone上激活OpenGL ES中的多重采样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!