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.
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