Add text to video in GL

One method of subtitling a video is shown in the example "Write subtitles onto a video". That shows hot to use the jit.lcd object in Jitter, and add its output to that of a jit.movie object. Another method is to render both video and text in GL using the jit.gl.videoplane and jit.gl.text objects. The latter way, shown here, is more computationally efficient because the rendering takes place on the graphics card of the computer instead of within a Jitter matrix on the computer’s CPU.

In this example, notice that the jit.gl.videoplane object has been scaled in the x and y dimensions so that it will have a 4:3 (x:y) aspect ratio corresponding to the dimensions of the video and the window that’s displaying it. Note also that the jit.gl.text object has its ‘layer’ attribute set to 1, which causes it to be drawn after (i.e., in front of) the jit.gl.videoplane, which is in layer 0 by default. (Lower layer numbers are drawn first.)

Chapter: