processing/processing4

PShape.setFill() no longer works

Open

#677 创建于 2023年2月23日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Java (176 fork)auto 404
help wantedopengl

仓库指标

Star
 (439 star)
PR 合并指标
 (PR 指标待抓取)

描述

Created by: cacheflowe

This used to work in Processing 3.x, but no longer works in recent Processing 4 versions.

Here's a complete sketch. In Processing 3.x and up to 4.0.b2, we see the box updates to random vertex colors. Since Processing 4.0.b4 (or maybe beta 3), it doesn't have an effect.

PShape shape;
  
public void setup() {
  size(640, 360, P3D);
  shape = createShape(BOX, 100, 100, 100).getTessellation();
  updateFill();
}

public void updateFill() {
  int numVerts = shape.getVertexCount();
  for (int i = 0; i < numVerts; i++) {
    shape.setFill(i, color(random(255), random(255), random(255)));
  }
}

public void draw() {
  background(0);
  translate(width/2, height/2, 0);
  rotateY(frameCount * 0.01);
  shape(shape);
}

贡献者指南