Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

OpenGL Cubemap Can only write to one face

I have a cubemap texture like this:

uint32_t skyboxTextureUnfiltered = -1;
glGenTextures(1, &skyboxTextureUnfiltered);
glBindTexture(GL_TEXTURE_CUBE_MAP, skyboxTextureUnfiltered);
glTexStorage2D(GL_TEXTURE_CUBE_MAP, 6, GL_RGBA32F, m_SkyboxSize, m_SkyboxSize);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

I run a compute shader on it like:

glBindImageTexture(0, skyboxTextureUnfiltered, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
glUseProgram(m_EquirectToCubeID);
glDispatchCompute(m_SkyboxSize, m_SkyboxSize, 6);

And my compute shader looks like :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(binding = 0, rgba32f) uniform imageCube outputTexture;

void main(void)
{
    imageStore(outputTexture, ivec3(gl_GlobalInvocationID), vec4(1.0f));
}

And after all this when I try to see its contents in RenderDoc, I only see the +X Face is white rest all are black.

Why is this happenning?

>Solution :

glBindImageTexture(0, skyboxTextureUnfiltered, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);

Here you pass GL_FALSE to the layered parameter. It means that only a single layer (here layer 0) will be bound. For cube-map textures, every face is a single layer.

You should pass GL_TRUE instead:

glBindImageTexture(0, skyboxTextureUnfiltered, 0, GL_TRUE, 0, GL_READ_WRITE, GL_RGBA32F);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading