Results 1 to 6 of 6

Thread: How to setup texture cube map array?

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2015
    Posts
    5

    How to setup texture cube map array?

    How to setup texture cube map array? I need some example.
    Code :
    HiGL_TexStorage3D(
    	GL_TEXTURE_CUBE_MAP_ARRAY,
    	Data->GetMipMap(),
    	DestFormat,
    	Data->GetWidth(),
    	Data->GetHeight(),
    	6 * Data->GetDepth()
    	);
    //how to fill data in cube map array???????
    //i need some code example.
    Thanks in advance

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,104
    Quote Originally Posted by Xiongmao View Post
    How to setup texture cube map array?
    Either:

    1. call glTexImage2D() for each face and mipmap level, using target parameters of GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, etc, or

    2. call glTexStorage2D() with a target parameter of GL_TEXTURE_CUBE_MAP, then call glTexSubImage2D() for each face and mipmap level to provide the texture data.

  3. #3
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,674
    Structurally, cubemap array textures are really just 2D array textures. So you should upload data to them like you would 2D array textures.

    The main difficulty is understanding the difference between cubemap array layers and cubemap array layer-faces. Layers are the number of individual cubemaps in the array. Layer-faces are the number of 2D images in the array, so it's the number of layers * 6. From the OpenGL side, you're dealing primarily with layer-faces.

    Quote Originally Posted by GClements View Post
    Either:

    1. call glTexImage2D() for each face and mipmap level, using target parameters of GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, etc, or

    2. call glTexStorage2D() with a target parameter of GL_TEXTURE_CUBE_MAP, then call glTexSubImage2D() for each face and mipmap level to provide the texture data.
    You answered the wrong question. He's asking how to send data to the cubemap array after creating storage for it, not how to create storage for it (which is code he already has).

    Also, that's the wrong answer for how to create storage for a cubemap array texture. His code is correct for that.

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2015
    Posts
    5
    Quote Originally Posted by GClements View Post
    Either:

    1. call glTexImage2D() for each face and mipmap level, using target parameters of GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, etc, or

    2. call glTexStorage2D() with a target parameter of GL_TEXTURE_CUBE_MAP, then call glTexSubImage2D() for each face and mipmap level to provide the texture data.
    I want to create cubemap array, not cubemap. This is my assume
    Code :
    GLenum CubeFace[] = {
    	GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
    	GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
    	GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
    };
    glTexStorage3D(
    	GL_TEXTURE_CUBE_MAP_ARRAY,
    	Data->GetMipMap(),
    	DestFormat,
    	Data->GetWidth(),
    	Data->GetHeight(),
    	6 * Data->GetDepth()
    	);
    for (size_t ai = 0; ai < Data->GetDepth(); ai++)
    {
    	for (size_t fi = 0; fi < 6; fi++)
    	{						
    		glTexSubImage3D(
    			CubeFace[fi], 0, 0, 0, ai, Data->GetWidth(), Data->GetHeight(), 1,
    			...
    			);
    	}
    }
    But from this:
    https://www.opengl.org/sdk/docs/man/...bImage3D.xhtml
    glTexSubImage3D target must be GL_TEXTURE_3D or GL_TEXTURE_2D_ARRAY, Very Confused to me. i don't know to create cubemap array.
    Thanks for reply.

  5. #5
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,674
    Quote Originally Posted by Xiongmao View Post
    But from this:
    https://www.opengl.org/sdk/docs/man/...bImage3D.xhtml
    glTexSubImage3D target must be GL_TEXTURE_3D or GL_TEXTURE_2D_ARRAY, Very Confused to me.
    That's because the documentation is wrong. It also take GL_TEXTURE_CUBE_MAP_ARRAY.

  6. #6
    Junior Member Newbie
    Join Date
    Mar 2015
    Posts
    5
    Quote Originally Posted by Alfonse Reinheart View Post
    That's because the documentation is wrong. It also take GL_TEXTURE_CUBE_MAP_ARRAY.
    Thanks.

Similar Threads

  1. Loading DDS textures into a cube map array
    By Sunny_Lime in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 08-27-2017, 09:55 AM
  2. How to initialize an array cube map
    By imported_Harukoxd in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-05-2016, 09:21 PM
  3. DSA Cube Map Setup
    By Admiral Habor in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-04-2015, 09:19 AM
  4. how to lookup cube map texture array in GLSL
    By shapeare in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-03-2012, 01:35 AM
  5. So how do I setup memory array
    By o9i8 in forum OpenGL: General
    Replies: 1
    Last Post: 02-10-2002, 05:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean