Hello, I am fairly new to processing and I have a bit of a problem that I can't seem to work out. I have an several arraylists set up to hold my bubble image objects. I want to be able to define how many bubble objects each arraylist stores at one time so the screen doesn't become over crowded.
OpenCV opencv; // Creates a new OpenCV object
PImage movementImg; // Creates a new PImage to hold the movement image
int poppedBubbles; // Creates a variable to hold the total number of popped bubbles
ArrayList bubbles; // Creates an ArrayList to hold the Bubble objects
ArrayList bubbles1;
ArrayList bubbles2;
ArrayList bubbles3;
ArrayList bubbles4;
ArrayList bubbles5;
ArrayList bubbles6;
PImage bubblePNG; // Creates a PImage that will hold the image of the bubble
PImage bubble1PNG; // Creates a PImage that will hold the image of the bubble
PImage bubble2PNG; // Creates a PImage that will hold the image of the bubble
PImage bubble3PNG; // Creates a PImage that will hold the image of the bubble
PImage bubble4PNG; // Creates a PImage that will hold the image of the bubble
PImage bubble5PNG; // Creates a PImage that will hold the image of the bubble
PImage bubble6PNG; // Creates a PImage that will hold the image of the bubble
void setup()
{
size ( 640, 480 ); // Window size of 640 x 480
oscP5 = new OscP5(this,12000);
opencv = new OpenCV( this ); // Initialises the OpenCV library
opencv.capture( 640, 480 ); // Sets the capture size to 640 x 480
movementImg = new PImage( 640, 480 ); // Initialises the PImage that holds the movement image
poppedBubbles = 0;
bubbles = new ArrayList(); // Initialises the ArrayList
bubbles1 = new ArrayList();
bubbles2 = new ArrayList();
bubbles3 = new ArrayList();
bubbles4 = new ArrayList();
bubbles5 = new ArrayList();
bubbles6 = new ArrayList();
bubblePNG = loadImage("bubble.png"); // Load the bubble image into memory
bubble1PNG = loadImage("bubble1.png"); // Load the bubble image into memory
bubble2PNG = loadImage("bubble2.png"); // Load the bubble image into memory
bubble3PNG = loadImage("bubble3.png"); // Load the bubble image into memory
bubble4PNG = loadImage("bubble4.png"); // Load the bubble image into memory
bubble5PNG = loadImage("bubble5.png"); // Load the bubble image into memory
bubble6PNG = loadImage("bubble6.png"); // Load the bubble image into memory
myBroadcastLocation = new NetAddress("127.0.0.1",57120);
}
void draw()
{
bubbles.add(new Bubble( (int)random( 0, width - 40), -bubblePNG.height, bubblePNG.width, bubblePNG.height)); // Adds a new bubble to the array with a random x position
bubbles1.add(new Bubble1( (int)random( 0, width - 40), -bubble1PNG.height, bubble1PNG.width, bubble1PNG.height));
bubbles2.add(new Bubble2( (int)random( 0, width - 40), -bubble2PNG.height, bubble2PNG.width, bubble2PNG.height));
bubbles3.add(new Bubble3( (int)random( 0, width - 40), -bubble3PNG.height, bubble3PNG.width, bubble3PNG.height));
bubbles4.add(new Bubble4( (int)random( 0, width - 40), -bubble4PNG.height, bubble4PNG.width, bubble4PNG.height));
bubbles5.add(new Bubble5( (int)random( 0, width - 40), -bubble5PNG.height, bubble5PNG.width, bubble5PNG.height));
bubbles6.add(new Bubble6( (int)random( 0, width - 40), -bubble6PNG.height, bubble6PNG.width, bubble6PNG.height));
I am trying to send information from Processing to Pure Data via OSC to trigger various sounds. I have set up a basic communication between Processing and Pure Data using OSC. Below you can see part of the OSC code integration in my Processing code.
In Pure Data I am using the dumpOSC, OSCroute and unpack objects. This works fine so far and the numbers 1 and 0 are printed in Pure Data if the processing code is true or false. The Problem I am having is when I try and create a new instance of 'OscMessage myMessage = new OscMessage("/test");' to send information from other interactions in the processing code which are happening at the same time. I just get an error in Pure Data stating the following:
error: unpack: type mismatch
"test2" 0: 2
Does anyone have any experience with unpacking multiple messages from OSC sent from Processing in Pure Data?
I don't think I made it clear in the post I made before. I want to make a class which consists of the ellipse which is controlled by noise as in the code posted below. I also want it to include the if statements for dist so I can have any number of ellipses and for it to work just like the code does below. Any help would be greatly appreciated as I have tried to put it into a class and it either stays static or I get error messages. I know this is probably really simple but I have just started learning.
import processing.opengl.*;
float diam = 100;
float a = 0;
I don't think I made it clear what I was trying to do in my previous code. I want to make a class which consists of the ellipse which is controlled by noise as in the code posted below. I also want it to include the if statements for dist so I can have any number of ellipses and for it to work just like the code does below. Any help would be greatly appreciated. I have tried to put it into a class but it either stays static on the screen or I keep getting error messages.
import processing.opengl.*;
float diam = 100;
float a = 0;