How to use split screen video sections as textures?

Here is what I am trying to do: load one split screen video (for example ) and then use either side of the video as a texture for two different GL shapes.

Hoping the community can point me in the right direction to answer this question:

  • How do you translate the position and crop the dimensions of textures on gl shapes?

Brainstorming about it, the first idea which comes to mind is to do the work myself on a canvas and then use my canvas as a texture. However, this might have performance penalties when using video.

Here is a template for where I would like the video to be split:


Any suggestions on this one? Amongst other applications would be sliding a video texture around on an object in response to the user’s input. Help appreciated.

Here is an example of translating the scaling a gl texture:

How do we control a texture in a similar way using p5.js?

Herein lies the answer to how to move a texture around on a gl shape: