Makogan
Makogan

Reputation: 9632

How should you initialize a cube map array in OpenGL 4.5?

Say I want a cube map array of 10 cube maps, each of 2048x2048 resolution and with only 1 mipmap level.

I am currently trying to initialize is as:

    glGenTextures(1, &shadowMapArray);

    glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, shadowMapArray);
    glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY,1, GL_R8, 2048, 2048, 10);

Which returns a GL_INVALID_VALUE enumerator.

Upvotes: 1

Views: 335

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 474266

For cube map arrays, the depth is not the number of array layers. It is the number of layer-faces, which must be a multiple of 6. So if you want 10 cube map array layers, you ask for 60 layer faces.

Every OpenGL API that deals in cube map arrays takes layer-face indices/counts, not layers.

Upvotes: 2

Related Questions