通过其他矩形渲染矩形

Rendering rectangles through other rectangles

出于某种原因,当我在当前处理草图中绘制另一个矩形时,它绘制在所有其他矩形填充上,但似乎没有绘制在其他矩形笔划上。当我再画一个草图时,这个问题并没有持续存在,但它在这个草图中一直发生。

重叠矩形图片

[]

例子

这是一个似乎重现问题的简化示例

void setup(){
  size(1000, 600 , P3D);
  surface.setResizable(true);
  //frameRate(120);
}


void draw(){
  if(width < 100)
    size(100,height,P3D);
  if(height < 100)
    size(width,100,P3D);

  fill(10);
  stroke(10);
  strokeWeight(10);
  rect(100,100,100,100);

  fill(255);
  stroke(100);
  strokeWeight(10);
  rect(0,0,300,300);
}

这是因为您使用 "P3D" 参数设置了大小。 P3D是一种3D渲染模式。这个结果可能是由于在 3D space 中渲染 2D rect() 函数的一些偏心。