Unable to export a MovieMaker movie
in
Core Library Questions
•
2 years ago
For some reason the below code won't export as a movie. I get a blank Java window which just sits there doing nothing until a stop the Processing script. The code runs fine without attempting to save to a movie.
Can anyone spot where I'm going wrong?
TIA
BTW this is on a Mac (10.5.8)
Can anyone spot where I'm going wrong?
TIA
BTW this is on a Mac (10.5.8)
- import javax.media.opengl.*;
- import processing.opengl.*;
- import processing.video.*;
- float a;
- boolean bExportVideo = true;
- MovieMaker mm;
- int MAX_FRAME_NB = 2400;
- void setup() {
- size(800, 600, OPENGL);
- frameRate(24);
- if (bExportVideo) {
- mm = new MovieMaker(this, width, height, "movie.mov", 24,
- MovieMaker.JPEG, MovieMaker.HIGH);
- }
- }
- void draw() {
- if (frameCount > MAX_FRAME_NB) {
- if (bExportVideo) {
- mm.finish();
- delay(1000);
- }
- exit();
- }
- background(255);
- PGraphicsOpenGL pgl = (PGraphicsOpenGL) g; // g may change
- GL gl = pgl.beginGL(); // always use the GL object returned by beginGL
-
- // Do some things with gl.xxx functions here.
- // For example, the program above is translated into:
- gl.glColor4f(0.7, 0.7, 0.7, 0.8);
- gl.glTranslatef(width/2, height/2, 0);
- gl.glRotatef(a, 1, 0, 0);
- gl.glRotatef(a*2, 0, 1, 0);
- gl.glRectf(-200, -200, 200, 200);
- gl.glRotatef(90, 1, 0, 0);
- gl.glRectf(-200, -200, 200, 200);
-
- pgl.endGL();
-
- a += 0.5;
- if (bExportVideo) {
- mm.addFrame();
- }
- }
2