Hi friends!. I hope someone can help me please. I am following this great tutorial but I have many questions.
Let’s see if I understand the basic idea.
- I must create the same number of FBOs that lights (maximum 8).
- I must create the same number of depth textures (shadow maps) that FBOs.
- For every FBO I must perform offscreen render (render to texture, drawing the scene from the point of view of each of the lights, maximum 8 times).
Is this correct or can I use just a texture with multiple FBOs, or fbo with various textures or how?
Assuming you use the idea above, how should the final render of the scene?
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);
Is this okay? I think not, because it uses a lot of resources and the scene would have to be drawn up to 8 times. (One per light source and shadow mapping).
Well but then how should the render scene with multiple light sources and shadows?
Thank you very much for your help.