[英]ProcessingJS not drawing images in 3D mode
I am trying to draw an image to canvas using ProcessingJS. 我正在尝试使用ProcessingJS在画布上绘制图像。 It works perfectly in 2D mode but not in 3D.
它在2D模式下可完美工作,但在3D模式下则不能。 The code looks the following:
该代码如下所示:
PImage img;
void setup(){
size(600, 400, OPENGL);
strokeWeight(1);
noFill();
frameRate(60);
imageMode(CENTER);
img = loadImage("img.png");
}
void draw(){
image(img, 20, 20);
}
Any ideas what might cause the problem? 有什么想法可能导致问题吗?
If you're using a version of Processing.js that is older than 1.3.0, then this link might explain why it doesn't work: 如果您使用的Processing.js版本早于1.3.0,那么此链接可能会解释为什么它不起作用:
https://processing-js.lighthouseapp.com/projects/41284/tickets/1511-image-doesnt-work-in-opengl-mode https://processing-js.lighthouseapp.com/projects/41284/tickets/1511-image-doesnt-work-in-opengl-mode
Otherwise, you might try mapping your image as a texture on a polygon like in this example: 否则,您可以尝试将图像作为纹理映射到多边形上,如以下示例所示:
http://processing.org/learning/3d/texture1.html http://processing.org/learning/3d/texture1.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.