Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 275
debonair Avatar asked Apr 22 '26 21:04

debonair


1 Answers

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.

like image 145
Colonel Thirty Two Avatar answered Apr 25 '26 04:04

Colonel Thirty Two



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!