Apply texture on beginShape(QUAD_STRIP);?
in
Programming Questions
•
1 year ago
I have search online, but not many post talking about this problem. I would like to apply texture on a 2D shape, but I don't know why the texture doesn't show. I have try to change the image as png, jpeg or jpg(I don't even know does it matter...) And also use
textureMode(NORMALIZED); or
textureMode(IMAGE);, but still cannot work. Please tell me which part I have done wrong.
Thank you so much!!!
- PImage a, b, c;
- void setup() {
- size(400, 400, P2D);
- noStroke();
- a = loadImage("ta.png");
- b = loadImage("tb.png");
- }
- void draw() {
- beginShape(QUAD_STRIP);
- textureMode(NORMALIZED);
- texture(a);
- vertex(0, 100);
- vertex(0, 300);
- vertex(200, 200);
- vertex(200, 400);
- endShape();
- beginShape(QUAD_STRIP);
- texture(b);
- vertex( 200, 200);
- vertex(200, 400);
- vertex(400, 100);
- vertex(400, 300);
- endShape();
- }
1