GL Texture Delay

From WikiName
Jump to: navigation, search

Whenever a frame delay effect is called for, most Jitter programmers know to reach for the jit.matrixset object to handle this task with ease, however when working with opengl textures, no single object will do the job. The technique described below was first documented in Andrew Benson's excellent Video Processing System tutorial, which is required reading for Jitter programmers.

The delay is accomplished by using two poly~ patches, one serves as a bank of jit.gl.texture objects, and the other serves to either send out capture messages for writing or jit_gl_texture messages for reading. The magic happens by using a jit.gl.videoplane object with automatic disabled, sending it the input frame, and setting it's capture attribute to the name of one of the textures in the texture-bank.

The basic steps of the delay are:

  • bang a counter to output a frame from the delay bank the delay-length of frames prior to the current frame
  • set the current frame in the delay bank for writing, by setting the videoplane's capture to that texture name
  • send in the current frame to the videoplane
  • bang the videoplane, causing it to capture to the aforementioned texture

In the example patch, the delay time is hard-coded to 60 frames (1 second at 60 FPS), but this could be easily modified. We also perform a simple multiplication with the original frame.

Patches attached as a zip file: File:Texture-delay.zip File:Texture-delay.png