Array Textures

Simple question regarding Array Textures. I have never used them, but am looking at them as an alternative to an array of samplers. Can one bind a TEXTURE_2D to a specific layer of a TEXTURE_2D_ARRAY easily, or does the memory have to be “contiguous” and thus copied into the TEXTURE_2D_ARRAY with a TexSubImage ?
My shader requires a set of textures which may change each frame. I’d like to be able to pick the texture using an index into an array.

Is this possible?


I have part of your answer:

Yes, texture arrays are a great alternative to the hacked implementation (personal opinion) of array of samplers.
The only drawback compared to an array of samplers is that all your textures must have the same resolution.

Haven’t used texsubimage with them, not sure how that works…

No, you can’t bind a GL_TEXTURE_2D into a GL_TEXTURE_2D_ARRAY. They could add that feature if it is considered important.
It needs to be contiguous if you want to use glTexImage3D to create a GL_TEXTURE_2D_ARRAY or you can call glTexImage3D with a NULL pointer and glTexImage3D will just allocate the memory space.
Then it is up to you to fill each layer with glTexSubImage3D.

Cool thanks a lot