Asynchronous glReadPixels with PBO

前端 未结 2 1315
天命终不由人
天命终不由人 2021-01-02 15:57

I want to use two PBOs to read pixel in alternative way. I thought the PBO way will much faster, because glReadPixels returns immediately when using PBO, and a lot of time c

相关标签:
2条回答
  • 2021-01-02 16:20

    BGRA is the fastest since this is the native format on modern GPUs. RGBA, RGB and BGR need 'reformatting' during readback.

    0 讨论(0)
  • 2021-01-02 16:33

    I do not know glutInitDisplayMode by heart, but this typically is because your internal and external format do not match. For example, you won't notice the asynchronous behaviour when the number of components do not match because this conversion still blocks the glReadPixels.

    So the most likely issue is that with glutInitDisplay(GLUT_RGBA) you will actually create a default framebuffer with an internal format that's actually RGB or even BGR. passing the GLUT_ALPHA parameter is likely to make it RGBA or BGRA internally, which matches the number of components you want.

    edit: I found an nvidia document explaining some issues about pixel packing and performance influence.

    edit2: The performance gain of BGRA is likely because the internal hw buffer is in BGRA, there's not really much more to it.

    0 讨论(0)
提交回复
热议问题