I'm making point lights with shadow maps, and currently I have it done with six depth map textures, each rendered individually and applied to the light map. This works quite well, but the performance cost is high.
Now, to improve the performance by reducing FBO changes and shader swapping between depthmap shader and lightmap shader, I was thinking of a couple of approaches. First one involves having a single texture, six times larger than the shadow map, and rendering all the point light depth maps "at once", and then using this texture to lay out the light map in one call. Is it possible to render only to portions of textures?
To elaborate the first example, it would be something like this:
1. Set shadow map size to 128x128
2. Create a depth map texture of 384x256 (3 x 2 shadow map)
3. Render the first 'side' of a point light to the rectangle (0, 0, 128, 128)
4. Render the second 'side' to the rectangle (128, 0, 128, 128)
5. - 9. Render the other 'sides' in a similar manner
10. Swap to light map mode
11. Render the light map in a single call using the 'cube-map'-ish depth texture
Second method I thought is to use 3D textures instead of partial rendering, but I still have a similar question: can I render to only a certain 'layer' of a 3D texture while retaining the other layers?