Fill over stroke?

edited August 2015 in How To...

for some reason I am getting this effect... the inner most circle which is filled in black is not removing the stroke from the arc. But when I copied the code out into a new sketch is is doing it correctly.

Any idea what I should be looking for in the code that might be causing this? I've tried removing blendMode but still nothing changes.

Screen Shot 2015-08-23 at 14.35.48

float timer;
void setup () {
  size (800, 600);
  frameRate(30);
}
void draw() {
  background(0);
  timer += 0.01;
  float a = map(sin(timer), -1, 1, 40, 360);

  float arc1 = map(sin(timer), -1, 1, 0, 360);
  float arc2 = map(cos(timer), -1, 1, 0, 360);
  strokeWeight(10);
  noFill();

  stroke(200, 0, 0, a);
  arc(width/2, height/2, 180, 180, radians(181), radians(arc1+180), OPEN);         ///// INNER RING /////
  stroke(0, 200, 0, a);
  arc(width/2, height/2, 300, 300, 0, radians(arc1), OPEN);                        ///// SECOND RING /////
  stroke(0, 0, 200, a);
  arc(width/2, height/2, 240, 240, radians(-arc1), 0, OPEN);                      //// MAIN RING //////
  stroke(200, 200, 0, a/2);
  arc(width/2, height/2, 360, 360, radians(-arc2+181), radians(180), OPEN);       //// OTHER RING /////
  stroke(0, 200, 200, a);
  fill(200, 0, 200, 60);
  arc(width/2, height/2, 360, 360, radians(-arc1+181), radians(180), PIE);      ///// OTHER RING //////
  fill(0);
  stroke(0);
  ellipse(width/2, height/2, 60, 60);        ////// INNERMOST CIRCLE /////
}

Answers

  • seems to be to do with using the P3D renderer instead of P2D...

  • I had the problem too... I think you need to Use P2D or JAVA2D instead...

  • Try fill (0, 0, 0, 0); or fill (0, 0, 0, 255); on line 27

    Failing that, it might be a depth buffer problem, which is why it'll go away with 2d renderer.

  • Answer ✓

    try this:

    hint(DISABLE_OPTIMIZED_STROKE);

    this will degrade performance with 3D renderers. If you don't need 3D then switch to P2D, it is still OpenGL but setup for 2D and the z coordinate is ignored.

  • cheers, I'll try disabling the optimised stroke. I switched the sketch to P2D and it runs at about half the framerate - not good!!

  • disable_optimised_stroke is the one with the P3D renderer. makes the sketch run at twice the FPS too... WINNING!! gota hope its all good on a rPi now

Sign In or Register to comment.