How do you activate multisampling in OpenGL ES on the iPhone?

筅森魡賤 提交于 2020-01-20 02:28:30

问题


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?


回答1:


The WWDC session 415 video goes over this a bit, so grab and watch that if you can.

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.

I'm still relatively new to OpenGL ES myself, but I hope this helps put you on the right track.




回答2:


Or just checkout apples documentation the matter: http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/WorkingwithEAGLContexts/WorkingwithEAGLContexts.html in the section "Use multisampling..."



来源:https://stackoverflow.com/questions/3340189/how-do-you-activate-multisampling-in-opengl-es-on-the-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!