PGraphics transparency with P3D

edited October 2017 in Questions about Code

Is there an issue w/ PGraphics/createGraphics and how transparency is handled when using P3D? Please check out this example. The rectangles at opacity of 20 fade to black as expected; but when P3D is added to setup() and createGraphics(), that effect is gone/lost.

Thank you.


PGraphics pg;

void setup() {
  size(400, 100);
  background(200);
  pg = createGraphics(400, 200);

  for (int i=0; i < 40; i++) { // draw horizontal lines
    //line(i * 10, 0, i * 10, height);
    line(0, i * 10, width, i*10);
  }

  pg.beginDraw();
  pg.fill(0,20);
  for (int i=0; i < 40; i++) {
    pg.rect(i * 5 + 5, 15, 400, 40);
  }
  pg.endDraw();
  image(pg, 0,0);
}

void draw() {

}
Tagged:

Answers

Sign In or Register to comment.