psychopy.tools.gltools.blitFBO

psychopy.tools.gltools.blitFBO(srcRect, dstRect=None, filter=9729)[source]

Copy a block of pixels between framebuffers via blitting. Read and draw framebuffers must be bound prior to calling this function. Beware, the scissor box and viewport are changed when this is called to dstRect.

Parameters:
  • srcRect (list of int) – List specifying the top-left and bottom-right coordinates of the region to copy from (<X0>, <Y0>, <X1>, <Y1>).

  • dstRect (list of int or None) – List specifying the top-left and bottom-right coordinates of the region to copy to (<X0>, <Y0>, <X1>, <Y1>). If None, srcRect is used for dstRect.

  • filter (int) – Interpolation method to use if the image is stretched, default is GL_LINEAR, but can also be GL_NEAREST.

Return type:

None

Examples

Blitting pixels from on FBO to another:

# bind framebuffer to read pixels from
GL.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, srcFbo)

# bind framebuffer to draw pixels to
GL.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, dstFbo)

gltools.blitFBO((0,0,800,600), (0,0,800,600))

# unbind both read and draw buffers
GL.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0)

Back to top