问题描述
我正在尝试改进基于 OpenGL ES 的应用程序的分辨率".苹果提到 here (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 session 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 中激活多重采样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!