So, here are the global rendering details:
- Game scene without light is rendered in a FBO
- Lights are rendered in a FBO
- These 2 FBO's are blended to create the scene.
- Each light is a quad using texture in grayscale with no alpha.
- Starting from a black screen, each light of the scene is added using glBlendFunc(GL2ES2.GL_ONE, GL2ES2.GL_ONE) and glBlendEquation(GL2ES2.GL_FUNC_ADD)
- Both FBO's textures are rendered each in a quad, the scene first then the light.
- Settings are glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA) and glBlendEquation(GL2ES2.GL_FUNC_ADD)
- In the corresponding fragment shader, final color is calculated multiplying RGB colors from the scene and the light, and alpha is 1.
Edited by Monsieur Max, 12 April 2013 - 06:33 AM.