p5.js this._renderer.image 不是功能问题

p5.js this._renderer.image is not a function issue

var adobe1bar1;
function preload() {
  adobe1bar1 = loadImage("1-1.png");
}
function setup() {
  createCanvas(500, 500, WEBGL);
  center = createVector(width / 2, height / 2, height / 2);
  cameraZ = -500;
}
function draw() {
  background(40); // backgraound white
  var cameraX = map(mouseX, 0, width, -500, 500); // map 
  var cameraY = map(mouseY, 0, height, -500, 500);
  console.log(cameraY, cameraX);
  if (cameraZ < -500) {
    cameraZ = -500;
  }
  if (cameraZ > 0) {
    cameraZ = 0;
  }
  camera(center.x + cameraX, center.y + cameraY, center.z + cameraZ, center.x, center.y, center.z, 0, 1, 0);
  translate(center.x, center.y, center.z);
  translate(0, 0, 0);
  image(adobe1bar1, -250, -250, 500, 500);
}

这是我的 p5.js 代码。

当我使用 image() function 不断出现以下错误信息。

Uncaught TypeError: this._renderer.image is not a function

有解决办法吗?

不使用时'WEBGL', 它上传图像没有错误, 但是 camera() 函数不起作用。

图像不是 WEBGL 函数。

尝试将图像纹理应用于平面。

texture(adobe1bar1);
translate(-250, -250, 0);
plane(500);

https://github.com/processing/p5.js/wiki/Getting-started-with-WebGL-in-p5

编辑: 要使用透明纹理,您需要启用混合模式,这可以通过以下方式完成:

fill(0,0,0,0); 

设置中