Not able to set transparency in P2D

edited May 2014 in Questions about Code

I have a bunch of code that is suppose to produce a semi transparent circle over another circle, and it works with the regular renderer, but not with P2D. I understand that for this example, P2D is not needed, but it is for a larger project, and I have isolated the problem to the renderer. Any idea why P2D doesn't produce transparent shapes in this case?

void setup() {
  background(0);
  size(700, 700, P2D);
  strokeWeight(2.5);
  stroke(255);
}

void draw() {
  background(0);
  //for the red, non transparent circle:
  fill(255,0,0);
  ellipse(100,75,50,50);
  //for the purplish transparent circle:
  fill(255, 0, 255, 150);
  ellipse(100,100,50,50);
}
Tagged:

Answers

  • Answer ✓

    I was lucky at placing updatePixels(); just before background(0);! @-)
    Using noLoop(); also worked in place of the former! %%-

  • If you are on Processing 2, P2D is OpenGL, and extra care must be taken to handle transparency, from what I have understood.

  • Works like a charm! Thanks

Sign In or Register to comment.