Hey guys,
i have a big problem. I tried to create a cube whit the surface of the webcam-pictures. I want to click six times and every time the picture of the webcam will save in the folder, but the cube doesn´t connect to the pictures....:/
float drehen = 0.3;
import processing.video.*;
Capture myCapture;
PImage img7,img8,img9,img10,img11,img12;
Capture cam;
void setup() {
img7 = loadImage("image0.0.jpg");
img8 = loadImage("image2.0.jpg");
img9= loadImage("image3.0.jpg");
img10 = loadImage("image4.0.jpg");
img11 = loadImage ("image5.0.jpg");
img12 = loadImage("image6.0.jpg");
rectMode(CENTER);
size(800, 800, P3D);
background(255);
//noStroke(); //uncomment this line to remove the stroke
frameRate(10000); // Set framerate
smooth(); // Antialiasing
myCapture = new Capture(this, 300,300);
String[] cameras = Capture.list();
if (cameras.length == 30) {
println("There are no cameras available for capture.");
exit();
} else {
println("Available cameras:");
for (int i = 20; i < cameras.length; i++) {
println(cameras[i]);
}
// The camera can be initialized directly using an
// element from the array returned by list():
cam = new Capture(this, 160, 120);
cam.start();
}
}
float saveincr;
void mousePressed()
{
saveincr++;
save("image"+saveincr+".jpg");
PImage img7,img8,img9,img10,img11,img12;
img7 = loadImage("image1.0.jpg");
img8 = loadImage("image1.0.jpg");
img9= loadImage("image1.0.jpg");
img10 = loadImage("image1.0.jpg");
img11 = loadImage ("image1.0.jpg");
img12 = loadImage("image1.0.jpg");
}
void draw() {
beginShape(); //definiere Polygon
texture(img7); //Screenshot on surface of the cube
vertex(300, 0, 0, 1, 0);
vertex(300, 300, 0, 1, 1);
vertex(0, 300, 0, 0, 1);
vertex(0, 0, 0, 0, 0);
endShape();//End Polygons
beginShape();//define Polygon
texture(img8);//Screenshot on surface of the cube
vertex(300, 0, -300, 1, 0);
vertex(300, 300, -300, 1, 1);
vertex(0, 300, -300, 0, 1);
vertex(0, 0, -300, 0, 0);
endShape(); //End Polygons
beginShape();//define Polygon
texture(img9); //Screenshot on surface of the cube
vertex(300, 0, -300, 1, 0);
vertex(300, 300, -300, 1, 1);
vertex(300, 300, 0, 0, 1);
vertex(300, 0, 0, 0, 0);
endShape(); //end Polygon
beginShape(); //define Polygon
texture(img10); //Screenshot on surface of the cube
vertex(0, 0, 0, 1, 0);
vertex(0, 300, 0, 1, 1);
vertex(0, 300, -300, 0, 1);
vertex(0, 0, -300, 0, 0);
endShape(); //End Polygons
beginShape(); //define Polygon
texture(img11); //Screenshot on surface of the cube
vertex(0, 0, 0, 1, 0);
vertex(300, 0,0, 1, 1);
vertex(300, 0, -300, 0, 1);
vertex(0, 0, -300, 0, 0);
endShape();//End Polygons
beginShape(); //define Polygon
texture(img12); //Screenshot on surface of the cube
vertex(300, 300, -300, 1, 0);
vertex(300, 300, 0, 1, 1);
vertex(0, 300, 0, 0, 1);
vertex(0, 300, -300, 0, 0);
endShape();//End Polygons
background(111);
if (cam.available() == true) {
cam.read();
}
image(cam,300, 300);
noFill();
translate(300,300);
rotate(radians(drehen),0,1,0);
drehen++;
box(300);
}