With OpenGL ES 2.0 on Android, is there a way preserve multisampling when rendering on a framebuffer?

人走茶凉 提交于 2019-12-08 05:15:46

问题


I am developing a 2d game on Android ICS using OpenGL es 2.0 and java. I am trying to use a lighting system and to do that I render all the lights on a framebuffer and the scene on another, with the intent to blend them using the fragment shader to recreate photoshop overlay effect.

I encountered a problem though, it seems that the fbo doesn't work with multisampling, so if I draw on the fbo I get jagged lines. I noticed that there is a solution for people using ios, but I didn't find anything on Android. Is there a better way to achieve what I am trying to do than the way I am approching this problem? Forgive, me I am a bit new to opengl.

Thank you very much.


回答1:


Multisampling (which you set when you create OpenGL context) works only on default framebuffer.

To have multisampling on FBO you must use one of these extensions:

  • GL_IMG_multisampled_render_to_texture
  • GL_APPLE_APPLE_framebuffer_multisample
  • GL_EXT_multisampled_render_to_texture

Alternatively you can use something like FXAA to achieve full screen anti-aliasing. It's "PC console" version is pretty quick even for mobile devices.



来源:https://stackoverflow.com/questions/10603779/with-opengl-es-2-0-on-android-is-there-a-way-preserve-multisampling-when-render

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