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.
IndexProgramming Questions & HelpPrograms › AIExport with noLoop();
Page Index Toggle Pages: 1
AIExport with noLoop(); (Read 499 times)
AIExport with noLoop();
Oct 12th, 2005, 6:46am
 
I am trying to export a sketch I did into Illustrator, and I have it all working only it is looping, and I'd kinda like it not to do that. If I put a noLoop() anywhere in my code I get an error (InterruptedExeption). I think it has something to do with the "opengl". If I take it out i can stop the loop but I can't seem to export due to some "opengl" error on my drawing function.

Sorry if this is a stupid wuestion I am pretty new at all this stuff.

thanks Matt

CODE
++++++++++++++++++++++++++++++++++++++++++++++
//ai export
import processing.opengl.*;
AIExport ai;

//creat color var for background
int backColor;

//create var for how many circle
int numCir;


void setup(){
 //set the size of the piece
 size(1224, 792, OPENGL);
 
 //num of circles
 numCir = int(random(50))*3;
 
 //ai export
 ai = new AIExport(this, 1);
 ai.monitorOff();
 ai.setContinuousRecordingFrameRate(2);
 ai.turnTransparencyOn();
 
}

void draw(){
 ai.run();
 ai.setLayer(1);
 
 //create background color
 background(int(random(255))+1);
 ai.ai_ellipseMode(CENTER);
 
 ai.ai_noStroke();
 smooth();
 
 //create circles
 for(int i=0; i<numCir; i++){
   //main circle scales
   int cirScale = int(random(100))*2;
   
   //determine fill color
   ai.ai_fill(int(random(255))+1, int(random(50))*5);
   
   //variable for x
   int x = int(random(width));
   int y = int(random(height));
   
   //draw first circle
   ai.ai_ellipse(x, y, cirScale, cirScale);
   
   //determine how many circles to add
   int subCir = int(random(10))*2+1;  
   
   //create array to hold scales
   int subCirScale[];
   subCirScale = new int[subCir];
   for(int j=0; j<subCir; j++){
    subCirScale[j] = int(random(100));
   }
   
   //sort array
   subCirScale = sort(subCirScale);
   subCirScale = reverse(subCirScale);
   
   for(int k=0; k<subCir; k++){
      ai.ai_fill(int(random(255))+1, int(random(250))+1);
      ai.ai_ellipse(x, y, subCirScale[k], subCirScale[k]);
      }
   }
}

void keyPressed(){
     if( key=='e' ) ai.exportOneFrame();
     if( key=='s' ) ai.takeSnapShot();
     if( key=='d' ) ai.dumpSnapShots();
     if( key=='r' ) ai.toggleContinuousRecording();
}

void mousePressed(){
 loop();
}
+++++++++++++++++++++++++++++++++++++++++++++++
Re: AIExport with noLoop();
Reply #1 - Oct 12th, 2005, 3:59pm
 
this is a problem between noLoop() and opengl. for the time being just use P3D.. if you're rendering a single frame and calling noLoop(), there's not really any need for OPENGL acceleration.

the bug is documented here, with notes:
http://dev.processing.org/bugs/show_bug.cgi?id=164

also, sketches using OPENGL cannot be exported, see the fourth item (or so) under the opengl section of the faq:
http://processing.org/faq/bugs.html#opengl
Page Index Toggle Pages: 1