简体   繁体   中英

ProcessingJS not drawing images in 3D mode

I am trying to draw an image to canvas using ProcessingJS. It works perfectly in 2D mode but not in 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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM