I have a texture with target GL_TEXTURE_2D_ARRAY. I want to render to each layer separately as FBO attachment. how do i bind particular layer to framebuffer as attachment?
Use the glFramebufferTextureLayer function to attach the texture layer to the FBO.
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, someTexture, mipmapLevel, layer);
Alternatively, use the gl_Layer variable in a geometry shader to select at render time which layer to render to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With