# how to read alpha in the framebuffer by glReadPixe

**URL:** <https://forums.imgtec.com/t/how-to-read-alpha-in-the-framebuffer-by-glreadpixe/420>\
**Category:** PowerVR Insider\
**Created:** [July 28, 2009, 2:34am UTC](https://forums.imgtec.com/t/how-to-read-alpha-in-the-framebuffer-by-glreadpixe/420 "2009-07-28T02:34:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![italylili](https://avatars.discourse-cdn.com/v4/letter/i/e68b1a/32.png) [@italylili](https://forums.imgtec.com/u/italylili)\
**Post date:** [July 28, 2009, 2:34am UTC](https://forums.imgtec.com/t/how-to-read-alpha-in-the-framebuffer-by-glreadpixe/420/1 "2009-07-28T02:34:02Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![xmas](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@xmas](https://forums.imgtec.com/u/xmas)\
**Post date:** [July 28, 2009, 9:39am UTC](https://forums.imgtec.com/t/how-to-read-alpha-in-the-framebuffer-by-glreadpixe/420/2 "2009-07-28T09:39:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![italylili](https://avatars.discourse-cdn.com/v4/letter/i/e68b1a/32.png) [@italylili](https://forums.imgtec.com/u/italylili)\
**Post date:** [July 29, 2009, 2:02pm UTC](https://forums.imgtec.com/t/how-to-read-alpha-in-the-framebuffer-by-glreadpixe/420/3 "2009-07-29T14:02:19Z")

</div>

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