Array Depth Texture Help

I’m trying to implement multi-light shadow mapping w/ glsl, and I’m a little confused. I’ve implemented single light mapping by using a FBO to render to a texture.

It seems like the way to extend it to many lights is to render to an array texture but I don’t understand how to render to a particular layer. How would I go about doing something like this:

allocate an array texture
for each light source
render to a layer of the texture

pass the arrayTexture to my frag shader


You have at least 2 choices:

  1. there is glFramebufferTextureLayer command that allows selecting a single layer of the array/3d texture to be attached to FBO
  2. layered rendering: set gl_Layer in the geometry shader