![]() |
在白色的polygon內透過[PGraphic]繪製一條線 |
[Processing Example]
本週的對抗裡,蝦爸提出了一個有趣的概念,企圖把過往繪製的圖形,當成貼圖材質,讓材質本身也是及時運算的結果。因此本週重點分為兩項,如何在虛擬攝影機中繪製影像並貼回原本物件,以及製造有趣複雜的貼圖材質。
[Processing code] ↓
PGraphics b; void setup() { size(600, 300, OPENGL); b=createGraphics(400, 400, OPENGL); } void draw() { b.beginDraw(); b.background(255); b.strokeWeight(5); b.stroke(255, 0, 0); b.line(0, 0, 400, 400); b.endDraw(); //image(a, 0, 0); background(0); camera(mouseX, mouseY, 200, 0, 0, 0, 0, 1, 0); beginShape(); textureMode(NORMAL); texture(b); vertex(-100, -100, 0, 0, 0); vertex(100, -100, 0, 1, 0); vertex(100, 100, 0, 1, 1); vertex(-100, 100, 0, 0, 1); endShape(); }
[Pd Example]
在Pd中,把繪製好的圖檔存在[gemframebuffer]物件中,並且以[GEMgl]等原生的OPENGL物件,來繪製頂點。
沒有留言:
張貼留言