Well, let's see if I understand the idea behind the shadow mapping.
- create a number of FBOs that lights (maximum 8)
- create same number of depth textures (shadow maps) for those FBOs
- for every FBO perform off-screen rendering (render to texture, drawing the scene from the point of view of each of the lights, maximum 8 times)
Is this correct?
But how do I render the final scene with shadows then? Do I have to render the whole scene for each shadow map?
int main() {
//Number of lights = 8;
glUseProgram(programa);
glUniformli(shadowM0,4);
glActivateTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D,depthT0);
//Draw Escene?
glUniformli(shadowM1,5);
glActivateTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_2D,depthT1);
//Draw Escene?
glUniformli(shadowM2,6);
glActivateTexture(GL_TEXTURE6);
glBindTexture(GL_TEXTURE_2D,depthT2);
//Draw Escene?
...
glUseProgram(0);
...
}
And if not, how should I do the final render of the scene?
Would appreciate any corrections to the above steps in case I missed something or any recommendations for improving the idea using forward rendering.