Reputation: 2593
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?
Upvotes: 3
Views: 389
Reputation: 26559
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.
Upvotes: 3