We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
OPENGL and video (Read 2796 times)
OPENGL and video
Jan 12th, 2009, 6:19pm
 
I'm sure this may have been covered somewhere already, does Processing OpenGL work with the MovieMaker library? If so, how do i make a movie of my OpenGL sketch. I haven't been able to do it no matter what i try.

Thanks,

JPW
Re: OPENGL and video
Reply #1 - Jan 14th, 2009, 9:35pm
 
This worked for me:

/**
* Esfera by David Pena
* Modified to to use MovieMaker with code from the
* DrawingMovie example
* Distribucion aleatoria uniforme sobre la superficie de una esfera.
* Runs slowly - be patient.
* Press space-bar to stop recording.
*/

import processing.video.*;
MovieMaker mm;

import processing.opengl.*;

int cuantos = 8000;
pelo[] lista ;
float[] z = new float[cuantos];
float[] phi = new float[cuantos];
float[] largos = new float[cuantos];
float radio = 200;
float rx = 0;
float ry =0;

void setup() {
 size(320, 240, OPENGL);

 mm = new MovieMaker(this, width, height, "esfera.mov");

 radio = height/3.5;
 
 lista = new pelo[cuantos];
 for (int i=0; i<cuantos; i++){
   lista[i] = new pelo();
 }
 noiseDetail(3);
 
}


void draw() {
 background(0);
 translate(width/2,height/2);

 float rxp = ((mouseX-(width/2))*0.005);
 float ryp = ((mouseY-(height/2))*0.005);
 rx = (rx*0.9)+(rxp*0.1);
 ry = (ry*0.9)+(ryp*0.1);
 rotateY(rx);
 rotateX(ry);
 fill(0);
 noStroke();
 sphere(radio);

 for (int i=0;i<cuantos;i++){
   lista[i].dibujar();

 }
 mm.addFrame();
}


void keyPressed() {
 if (key == ' ') {
   // Finish the movie if space bar is pressed
   mm.finish();
   // Quit running the sketch once the file is written
   exit();
 }
}

class pelo
{
 float z = random(-radio,radio);
 float phi = random(TWO_PI);
 float largo = random(1.15,1.2);
 float theta = asin(z/radio);

   void dibujar(){

   float off = (noise(millis() * 0.0005,sin(phi))-0.5) * 0.3;
   float offb = (noise(millis() * 0.0007,sin(z) * 0.01)-0.5) * 0.3;

   float thetaff = theta+off;
   float phff = phi+offb;
   float x = radio * cos(theta) * cos(phi);
   float y = radio * cos(theta) * sin(phi);
   float z = radio * sin(theta);
   float msx= screenX(x,y,z);
   float msy= screenY(x,y,z);

   float xo = radio * cos(thetaff) * cos(phff);
   float yo = radio * cos(thetaff) * sin(phff);
   float zo = radio * sin(thetaff);

   float xb = xo * largo;
   float yb = yo * largo;
   float zb = zo * largo;
   
   beginShape(LINES);
   stroke(0);
   vertex(x,y,z);
   stroke(200,150);
   vertex(xb,yb,zb);
   endShape();
 }
}
Re: OPENGL and video
Reply #2 - Jan 15th, 2009, 6:07am
 
Very cool, thanks for the code. It compiles and then draws a blank window. I'm waiting and nothing seems like it will happen. Yeah, nothing's happening. I inserted a "println()" and nothing happened. What have i done wrong?

Jair-Rohm
Re: OPENGL and video
Reply #3 - Jan 15th, 2009, 7:56am
 
Hey guys, we have been following this issue over at this thread:

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1229986984

It seems to be a problem only on OS X and it also seems to be inside of the MovieMaker class. As a quick fix, I replaced video.jar in 1.0.1 with the video.jar from 0135. You can do this by right-clicking on Processing.app --> Show package content --> navigate to the Resources/Java/libraries/video folder. And replace it.

One other thing, try running the applet in "present" mode Sketch --> Present . That seemed to be the only way to work this for me after making the video.jar replacement.

you can get 0135 on the download page:
http://processing.org/download/index.html
Re: OPENGL and video
Reply #4 - Jan 15th, 2009, 2:58pm
 
Thanks beckel, I'm running on XP, therefore no problem.
Re: OPENGL and video
Reply #5 - Jan 15th, 2009, 3:13pm
 
Thanks for the help. It's very much appreciated.

Good will to all!

JPW
Re: OPENGL and video
Reply #6 - Jan 17th, 2009, 4:02am
 
I tried beckel's solution. No go in my macbook pro Sad

Is there an alternate solution?
Re: OPENGL and video
Reply #7 - May 11th, 2010, 5:14pm
 
same problem in 1.1. works fine in present mode, but normal running doesn't work on mac 10.5.8
Page Index Toggle Pages: 1