Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Gl_texture_cube_map_array

  1. #1
    Junior Member Regular Contributor
    Join Date
    Dec 2010
    Location
    Oakville, ON, CA
    Posts
    165

    Gl_texture_cube_map_array

    Hi!
    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?

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    5,932
    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."

  3. #3
    Junior Member Regular Contributor
    Join Date
    Dec 2010
    Location
    Oakville, ON, CA
    Posts
    165
    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?

  4. #4
    Junior Member Newbie IonutCava's Avatar
    Join Date
    May 2012
    Location
    Bristol, U.K.
    Posts
    27
    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.

  5. #5
    Junior Member Regular Contributor
    Join Date
    Dec 2010
    Location
    Oakville, ON, CA
    Posts
    165
    Oh, I see. Now I understand.
    Thank you very much, guys!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •