Resize a movie
in
Contributed Library Questions
•
3 years ago
I'm trying to make the movie the same sizes as the background.
Any Ideas?
import jmcvideo.*;
import processing.opengl.*;
import javax.media.opengl.*;
JMCMovieGL myMovie;
int pvw, pvh;
float mySpeed;
void setup()
{
size(270, 480, OPENGL);
frame.setResizable(true);
background(0);
myMovie = movieFromDataPath("SuperHeroSound.mov");
myMovie.loop();
}
void draw()
{
mySpeed = map(mouseX, 0, width, -4, 4);
myMovie.setRate(mySpeed);
PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
GL gl = pgl.beginGL();
{
if (pvw != width || pvh != height)
{
background(0);
gl.glViewport(0, 0, width , height);
pvw = width;
pvh = height;
}
myMovie.centerImage(gl);
}
pgl.endGL();
}
JMCMovieGL movieFromDataPath(String filename)
{
return new JMCMovieGL(this, filename, RGB);
}
1