[Bf-committers] glReadPixels

Goat Man goatman.py at gmail.com
Mon Nov 9 06:38:34 CET 2009

I'm wanting to capture the screen for managed hardware rendering, and the
alpha channel is needed so that later the passes can be composited with
software rendered layers.  It seems that glReadPixels will not return the
alpha channel?  I have captured the alpha before from a hardware render
outside of blender from python/pyopengl/pygame.  I have tried the code below
from blender2.49 (haven't tried it yet from 2.5).
Could it depend on my graphics card drivers?

b = BGL.Buffer( BGL.GL_BYTE, (screenx, screeny, 4) 0
BGL.glReadPixels( 0, 0, screenx, screeny, BGL.GL_RGBA, BGL.GL_UNSIGNED_BYTE,
b )

for y in range(screeny):
  for x in range(screenx):
    r,g,b,alpha = b[ y ][ x ]

#alpha always is 255

More information about the Bf-committers mailing list