We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello to the Forum! I've been using Processing for quite a while and i really love it. So far i was able to do anything that came up my mind without having to ask here. But now I cannot figure out how to do this:
I want to divide the sketch screen into a set of cubes/squares, e.g. 6x4 and have 1 video to play on all of them, making it look like there is just 1 video playing. Later I will want to move some of the cubes on the z axis while the video is playing for audio-visualization. I was trying to use the video as a texture. While processing was not returning any errors, i could only see a blank screen. I have then tried to work around it with a PImage tex which i load with myMovie.get(0,0, width, height). It was applied as a texture to the cube, but the video would only update every few seconds. I have been searching a lot, but I cannot find any examples for what i want to do. I am not sure if using textures is a a good appoach to this problem. So I am hoping there is somebody here who has a better idea or who can tell me how to properly use a video as a texture and apply it to the cubes.
Answers
The Capture class extends PImage, so both statements above are the same.
What resolution are you using? If you try a lower resolution, does it speed the "show"?
Kf
It's almost impossible to find the bottleneck in code we can't see...
Thank you for your replies. I am working on it. My fault was not to use the v and u values in vertex. The code below works. Next step will be to figure out how to adress the different squares in order to change their z values. I will try to use PShape[] for that.
code formatted.
what size (pixels) is the video?
it's here and is probably the same size as the screen
https://github.com/processing/processing-video/blob/master/examples/Movie/Reverse/data/transit.mkv
(i was worried that you were trying to squeeze a 4k video or something ridiculous onto a 640x360 sketch)
After i got the effect working i noticed i would also like the squares to be able to grow in size instead of only changing their z position. I have tried to achieve this with scale. After calling scale for a single square and after the vertices are set, i reset it back to the original value, so the subsequent squares are not affected. The square however changes its position due to the scaling. Is there a more suitable method than scale? Or do i need to use transform?
This is the current code:
I already found an answer to the question from my last post. Instead of using scale I have to alter the first two values of each vertex to grow/shrink the size of single squares.