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 & HelpOpenGL and 3D Libraries › Mesh with object Thanks..
Page Index Toggle Pages: 1
Mesh with object ? Thanks.. (Read 564 times)
Mesh with object ? Thanks..
May 31st, 2009, 5:34am
 
Guys I'm in crisis Sad I wanted to know how it was possible to create an object each time processing receives an input (eg. pressing the mouse). And in last, the objects created when touching others (objects) are united, to form a reticulate or mesh.

Thank you in advance for your patience..
G.
Re: Mesh with object ? Thanks..
Reply #1 - May 31st, 2009, 11:21am
 
See this: (http://processing.org/reference/mousePressed_.html)
Note the distinction with this: (http://processing.org/reference/mousePressed.html)

The first one might be called many time per frame, the other one is per frame based.

Then, you would have something like:
Code:

int arrCount = 0;
MyObject[] myArray = new MyObject[100];

class MyObject{
  MyObject(){
      //Constructor...
  }
}

void mousePressed() {
   myArray[arrCount++] = new MyObject();
}

And, for the last part, I'm not sure if I understood correctly.
Page Index Toggle Pages: 1