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 › a link to another pde
Page Index Toggle Pages: 1
a link to another pde (Read 581 times)
a link to another pde
Jan 9th, 2010, 4:33am
 
hello, I've a probem with processing.
I want to make a link from a P3D to another pde in P2D and that, when someone clic on the button, the first pde close and the second open. how can I do that? I've test to export everyfile but the index of the P3D don't load, (he's may too big?). But that's not the problem...
Really I want link two P3D? can you help me please?

(sorry my english is not very good , I hope that you understand my question).
thank you
Re: a link to another pde
Reply #1 - Jan 13th, 2010, 9:57am
 
I don't think what you're asking for is possible.

Could you use offscreen PGraphics to achieve the same effect?

For example:

Quote:
/// "ThreeViews" by TfGuy44 (TfGuy44@gmail.com)
PGraphics BC, GC, RC;
float rot = 0.0;

void setup(){
  size( 400, 200, P2D);
  BC = createGraphics(200, 200, P3D);
  RC = createGraphics(200, 200, P3D);
  GC = createGraphics(200, 200, P3D);
}

void draw(){
  rot=(rot+0.01)%360;
  background(0);
  noStroke();
  fill(color(255,0,0));
  rect(10,40,20,20);
  fill(color(0,0,255));
  rect(70,70,20,20);
  fill(color(0,255,0));
  rect(70,10,20,20);
  if( get( mouseX, mouseY ) == color(255,0,0) ){
    RC.beginDraw();
    RC.background(color(128,0,0));
    RC.fill(color(255,0,0));
    RC.lights();
    RC.translate(100,100,0);
    RC.rotateX(rot);
    RC.rotateY(2*rot);
    RC.box(20);
    RC.endDraw();
    image( RC.get(), 200, 0);
  }
  if( get( mouseX, mouseY ) == color(0,255,0) ){
    GC.beginDraw();
    GC.background(color(0,128,0));
    GC.fill(color(0,255,0));
    GC.lights();
    GC.translate(100,100,0);
    GC.rotateX(rot);
    GC.rotateY(2*rot);
    GC.box(50);
    GC.endDraw();
    image( GC.get(), 200, 0);
  }
  if( get( mouseX, mouseY ) == color(0,0,255) ){
    BC.beginDraw();
    BC.background(color(0,0,128));
    BC.fill(color(0,0,255));
    BC.lights();
    BC.translate(100,100,0);
    BC.rotateX(rot);
    BC.rotateY(2*rot);
    BC.box(80);
    BC.endDraw();    
    image( BC.get(), 200, 0);
  } 
}

Page Index Toggle Pages: 1