Hello!
I am try to render equirectangular environment map to cubemap, following the learnopengl in my project., but something wired happened.
At first I created a framebuffer only with a depth attachment and using
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + index, renderID, 0);
to set each face of cubemap as color attachment. The use shader to render. But failed, cubemap is still black.
The I add a color attachment as color attachment0 for framebuffer, then again using
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + index, renderID, 0);
to render. Now only first face of cubemap has right result, other faces is still black.
I use Nsight to check the render process, find each face had a render process but only one has right result. (For debug, I render cubemap in every frame. But alought i only render in init fuction, the result is same.)
I wonder konw why this happened? Thank you.