P3D declared PGraphics doesn’t show anything.

Hello. I've trouble with creating a P3D Graphics object outside of draw().

When I try to run the same code, which is working fine in Java2D everything works as expected. When I switch to P2D or PD2 nothing will be shown at all.

The same Code works fine I i just run him in draw() itself without inititializing a PGraphic.

Basically I try to make a bunch of random distributed ellipses and try to displace them later on, over a vertex plane, so it wouldnt be necessary to create the ellipses in 3D but for assigining them as a texture I will definitely need an P3D object.

I've tried to resize the PGraphics, to check if it is just a size problem. Updated all my Drivers. Tried processing for win32 and win64 but nothing works. If somebody

void setup() { size(1207, 859, P3D); } void draw() { background(255); PImage test = displace().copy(); test.resize(width, 0); image(test, 0, 0); } PImage displace() { int w = 5031; int h = 3579; PGraphics output = createGraphics(w, h, P3D); int randomCirclesNum = round(random(5, 15)); float[] radii = new float [randomCirclesNum]; PVector[] positions = new PVector[randomCirclesNum]; for (int i = 0; i < randomCirclesNum; i++) { float radius = random(300, 2000); float x = output.width; float y = output.height; radii[i] = radius; positions[i] = new PVector(random(radius/2, x - radius/2), random(radius/2, y - radius/2)); } output.beginDraw(); output.background(0); for (int i = 0; i < randomCirclesNum; i++) { output.noStroke(); output.fill(255); output.ellipse(positions[i].x, positions[i].y, radii[i], radii[i]); } output.endDraw(); return output.get(); } 

submitted by /u/enuboll
[link] [comments]

Programming for Artists

Privacy Statement