debonair
debonair

Reputation: 2593

Attaching particular layer in GL_2D_ARRAY_TEXTURE to framebuffer

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

Answers (1)

Colonel Thirty Two
Colonel Thirty Two

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

Related Questions