Ping Pong - jgoffeney/Cesium4Unreal GitHub Wiki

Back

The ping pong method is used in OpenGL for post processing to take a rendered output and the further applying an effect by using one texture as an input and a second texture as a rendering target. To perform multiple rendering passes the role of the textures are flipped with the original input now the target texture.

Resources

Method

  • Set up a pair of framebuffers and textures.
  • Declare a variable to toggle between the value of 0 and 1 for each loop. The current value is the source and current value mod 2 is the target.
  • Within the loop:
    • Bind the target framebuffer (glBindFramebuffer).
    • Bind the source texture (glBindTexture).
    • Render the scene
    • Toggle the source/target index.
  • For multiple source textures see this.