# How to use split screen video sections as textures?

**URL:** https://discourse.processing.org/t/how-to-use-split-screen-video-sections-as-textures/11463
**Category:** Coding Questions
**Created:** [May 21, 2019, 12:19pm UTC](https://discourse.processing.org/t/how-to-use-split-screen-video-sections-as-textures/11463 "2019-05-21T12:19:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jedierikb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jedierikb/32/5268_2.png) [@jedierikb](https://discourse.processing.org/u/jedierikb)
#### Post date: [May 21, 2019, 12:19pm UTC](https://discourse.processing.org/t/how-to-use-split-screen-video-sections-as-textures/11463/1 "2019-05-21T12:19:45Z")

</div>

Here is what I am trying to do: load one split screen video (for example [https://www.youtube.com/watch?v=5eEXKzbeH7c](https://www.youtube.com/watch?v=5eEXKzbeH7c) ) 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:  
[https://codepen.io/jedierikb/pen/dEVKWL?editors=1010](https://codepen.io/jedierikb/pen/dEVKWL?editors=1010)

Thanks,  
Erik

---

<div class="post-metadata">

### Author: ![jedierikb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jedierikb/32/5268_2.png) [@jedierikb](https://discourse.processing.org/u/jedierikb)
#### Post date: [May 28, 2019, 6:16pm UTC](https://discourse.processing.org/t/how-to-use-split-screen-video-sections-as-textures/11463/2 "2019-05-28T18:16:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jedierikb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jedierikb/32/5268_2.png) [@jedierikb](https://discourse.processing.org/u/jedierikb)
#### Post date: [June 2, 2019, 1:56am UTC](https://discourse.processing.org/t/how-to-use-split-screen-video-sections-as-textures/11463/3 "2019-06-02T01:56:39Z")

</div>

Here is an example of translating the scaling a gl texture:  
[http://learnwebgl.brown37.net/10\_surface\_properties/texture\_mapping\_transforms.html](http://learnwebgl.brown37.net/10_surface_properties/texture_mapping_transforms.html)

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

---

<div class="post-metadata">

### Author: ![jedierikb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jedierikb/32/5268_2.png) [@jedierikb](https://discourse.processing.org/u/jedierikb)
#### Post date: [June 13, 2019, 4:54pm UTC](https://discourse.processing.org/t/how-to-use-split-screen-video-sections-as-textures/11463/4 "2019-06-13T16:54:34Z")

</div>

Herein lies the answer to how to move a texture around on a gl shape:  
[https://p5js.org/reference/#/p5/textureWrap](https://p5js.org/reference/#/p5/textureWrap)
