Skip to main content
added 280 characters in body
Source Link
user1430
user1430

RenderLook up "rendering to textures" in OpenGL. This will let you render your scenes to alternating render targets backed by textures named, say, A and B. By alternating them, one texture always contains “this frame” and the other the “last frame.”

Then you can bind them both and render a single full screen triangle to composite themSo every frame, averaging the colors as you like.you'd:

  1. Swap A and B.
  2. Bind A as a render target; render the game as normal to A.
  3. Bind A and B as textures to read from.
  4. Render a single triangle (or quad) that covers the full screen using a fragment shader that samples from both A and B and blends them however you want.

Render your scenes to alternating render targets backed by textures. By alternating them, one texture always contains “this frame” and the other the “last frame.”

Then you can bind them both and render a single full screen triangle to composite them, averaging the colors as you like.

Look up "rendering to textures" in OpenGL. This will let you render your scenes to alternating render targets backed by textures named, say, A and B. By alternating them, one texture always contains “this frame” and the other the “last frame.”

So every frame, you'd:

  1. Swap A and B.
  2. Bind A as a render target; render the game as normal to A.
  3. Bind A and B as textures to read from.
  4. Render a single triangle (or quad) that covers the full screen using a fragment shader that samples from both A and B and blends them however you want.
Source Link
user1430
user1430

Render your scenes to alternating render targets backed by textures. By alternating them, one texture always contains “this frame” and the other the “last frame.”

Then you can bind them both and render a single full screen triangle to composite them, averaging the colors as you like.