Search code examples
c++copengltexturesframebuffer

Do textures and renderbuffers share the same space on a framebuffer object?


For instance, if I attach a renderbuffer to GL_DEPTH_ATTACHMENT and then proceed to attach a texture to GL_DEPTH_ATTACHMENT, will the renderbuffer still be attached?


Solution

  • Yes, they do share the "same space."

    Technically, what you attach to FBOs are images. These images can take the form of a renderbuffer or a myriad of different types of textures, some of which are actually multiple different images (necessitating things like layered rendering to use all of the images in a texture in a single draw).

    In any event, attaching an image to a specific location in an FBO evicts the old attachment.