I have troubles understanding the process of creation and image’ uploading of this new fancy texture type - the specs and wiki did not gave me a clear picture on that process. No examples I have seen so far as well. Did anyone used the GL_TEXTURE_CUBE_MAP_ARRAY textures? Can anyone, please, post an example code of the texture initialization using glTexImage3D or glTexStorage3D+glTexSubImage*D?
What part of the process were you unclear on? Basically, you treat a cubemap array texture exactly like a 2D array texture. The only difference is that, when you access from it within the shader, 6 array layers is considered a single cubemap (and thus, the number of layers that the shader sees is the number you specify divided by 6).
That’s what the whole “layer vs. layer-face” thing the Wiki is talking about means. Hence the statement “When allocating storage for a cubemap array, the number of layer-faces is provided as the depth parameter, not the number of layers.”
Well, for regular cubemap textures I create a GL_TEXTURE_CUBE_MAP type texture, then I upload images using glTexImage2D to 6 different targets: GL_TEXTURE_CUBE_MAP__. Now, if I understand correctly, for GL_TEXTURE_CUBE_MAP_ARRAY there is no way to upload layered faces individually (like with glTexImage3D and 6 targets), right? So for array cubemaps I upload once the whole single pack consisting of 6*n slices where n is a number of layers each face has? Is this correct?
Judging from the spec:
If target is TEXTURE_CUBE_MAP_ARRAY_ARB or
PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB, specifying a depth value that is
not a multiple of six results in an error of INVALID_VALUE.
When <target> is TEXTURE_CUBE_MAP_ARRAY_ARB or
PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB <width> and <height> must be equal,
otherwise the error INVALID_VALUE is generated. Also, <depth> must
be a multiple of six indicating 6N layer-faces in the cube map
array, otherwise the error INVALID_VALUE is generated.
you use the glTexSubImage3D functions. Use depth for the face and array index.
There’s an example in the Wiki: “Similarly, when uploading texel data to the cubemap array, the parameters that represent the Z component are layer-faces. So if you want to upload to the positive Z axis of the second layer in the array, you would use index 10 (layer 1 * 6 faces per layer + face index 4).”
So instead of using TexSubImage2D, use TexSubImage3D with the proper Z offset.
Oh, I see. Now I understand.
Thank you very much, guys!