Open aidanlincolnn opened 4 years ago
Not sure if the webcam has anything to do with it, cause this results in an array with only zero's as well:
PGraphics pg;
public void settings() {
size(512, 512, P3D);
}
public void setup() {
pg = create_some_graphics();
pg.loadPixels();
}
public void draw() {
background(0);
image(pg, 0, 0);
}
PGraphics create_some_graphics() {
PGraphics pg = createGraphics(512, 512, P3D);
pg.beginDraw();
pg.background(0);
pg.pointLight(255, 0, 0, 0, height/2, 500);
pg.pointLight(0, 0, 255, width, height/2, 500);
pg.pointLight(0, 255, 0, width/2, 0, 500);
pg.translate(width/2, height/2);
pg.rotateY(0.01f * random(123));
pg.rotateX(0.05f * random(456));
pg.rotateZ(0.07f * random(789));
pg.fill(255);
pg.sphere(150);
pg.box(500, 20, 20);
pg.box(20, 500, 20);
pg.box(20, 20, 500);
pg.endDraw();
return pg;
}
This issue still remains, and no solution can be found.
Description
When you create a canvas with P2D or P3D, the webcam capture does not contain any data (it is an array of black pixels).
Expected Behavior
The capture object pixel array should contain data
Current Behavior
The capture object pixel array contains all black
Steps to Reproduce
Run this program import processing.video.*; Capture video; PImage theImage;
void setup() { //this loads an array of black pixels size(640, 480, P3D); //this works as expected //size(640, 480); video = new Capture(this, 640, 480); video.start(); }
void draw(){ if (video.available()) video.read(); theImage = video.get(); theImage.loadPixels(); image(theImage,0,0); }
Your Environment