Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: How to read a texture array that is bound to FBO's color attachment

  1. #1
    Newbie Newbie
    Join Date
    Jul 2013
    Posts
    2

    How to read a texture array that is bound to FBO's color attachment

    Sorry,I could not find much information on this.

    I have a FBO that has a texture array of size 4 that is attached to its color attachment point. Similarly there is another texture array of size 4 attached to the depth attachment point.

    After I render to this FBO, I want to read from the 2nd layer of the texture array into a CPU buffer. How do I do this?

    I know, if there was a simple 2D texture instead of a texture array bound to this FBO, I would have simply done:

    glReadBuffer(GL_COLOR_ATTACHMENT0);
    glReadPixels(...

    But how do I do in case of 2D array bound to FBO? Can we tweak glReadPixels to read a particular layer?

  2. #2
    Junior Member Regular Contributor tksuoran's Avatar
    Join Date
    Mar 2008
    Location
    Cambridge, UK
    Posts
    224
    You use glReadBuffer to choose the attachment point which you read from. Each attachment point can only have one layer of the array bound.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •