how to read alpha in the framebuffer by glReadPixe

This topic contains 2 replies, has 2 voices, and was last updated by  italylili 8 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29867

    italylili
    Member
    hi,

    how to read alpha in the framebuffer by glReadPixels?

    i try like this, but failed

    glReadPixels(0,0,64,64, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, renderbuf);
    #33276

    Xmas
    Member

    The only format/type combination that always works with glReadPixels is GL_RGBA/GL_UNSIGNED_BYTE.

    There is also one implementation-specified format/type combination which works. To find out what it is you need to query GL_IMPLEMENTATION_COLOR_READ_FORMAT and GL_IMPLEMENTATION_COLOR_READ_TYPE using glGetIntegerv. This format/type may depend on the pixel format of the current read surface, so you need to query it while the surface you want to read from is bound.

    If your application requires a fixed format, though, GL_RGBA/GL_UNSIGNED_BYTE is the only safe option.

    #33277

    italylili
    Member

    thank you very much , i have read the alpha using this way

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.