texture1.pde

来自「This is processing for java examples.」· PDE 代码 · 共 29 行

PDE
29
字号
/** * Texture 1.  *  * Load an image and draw it onto a quad. The texture() function sets * the texture image. The vertex() function maps the image to the geometry. */PImage img;void setup() {  size(640, 360, P3D);  img = loadImage("berlin-1.jpg");  noStroke();}void draw() {  background(0);  translate(width / 2, height / 2);  rotateY(map(mouseX, 0, width, -PI, PI));  rotateZ(PI/6);  beginShape();  texture(img);  vertex(-100, -100, 0, 0, 0);  vertex(100, -100, 0, 400, 0);  vertex(100, 100, 0, 400, 400);  vertex(-100, 100, 0, 0, 400);  endShape();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?