| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 060c754 commit da0f293
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,25 @@ | |||
| 1 | 1 | import processing.glw.*; | |
| 2 | 2 | ||
| 3 | + PGraphics stage; | ||
| 4 | + | ||
| 3 | 5 | void setup() { | |
| 4 | - size(2560, 1440, GLW.P2D); | ||
| 6 | + // The main window will be hidden, only GLW.RENDERER | ||
| 7 | + // can be used in size() | ||
| 8 | + size(100, 100, GLW.RENDERER); | ||
| 9 | + | ||
| 10 | + stage = createGraphics(2560, 1440, GLW.P2D); | ||
| 11 | + GLW.createWindow(stage); | ||
| 5 | 12 | frameRate(180); | |
| 6 | 13 | } | |
| 7 | 14 | ||
| 8 | 15 | void draw() { | |
| 9 | - background(255, 0, 0); | ||
| 10 | - | ||
| 11 | - fill(255); | ||
| 12 | - text("FPS: " + frameRate, mouseX, mouseY); | ||
| 13 | - } | ||
| 16 | + // The draw() method is used to update the offscreen surfaces, | ||
| 17 | + // but not to draw directly to the screen. | ||
| 18 | + stage.beginDraw(); | ||
| 19 | + stage.background(200); | ||
| 20 | + stage.fill(255); | ||
| 21 | + stage.ellipse(mouseX, mouseY, 50, 50); | ||
| 22 | + stage.fill(0); | ||
| 23 | + stage.text(frameRate, 100, 100); | ||
| 24 | + stage.endDraw(); | ||
| 25 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,28 @@ | |||
| 1 | + import processing.glw.*; | ||
| 2 | + | ||
| 3 | + PGraphics canvas1; | ||
| 4 | + PGraphics canvas2; | ||
| 5 | + | ||
| 6 | + void setup() { | ||
| 7 | + size(100, 100, GLW.RENDERER); | ||
| 8 | + canvas1 = createGraphics(320, 240, GLW.P2D); | ||
| 9 | + canvas2 = createGraphics(320, 240, GLW.P2D); | ||
| 10 | + GLW.createWindow(canvas1); | ||
| 11 | + GLW.createWindow(canvas2); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + void draw() { | ||
| 15 | + canvas1.beginDraw(); | ||
| 16 | + canvas1.background(200); | ||
| 17 | + canvas1.ellipse(mouseX, mouseY, 100, 100); | ||
| 18 | + canvas1.endDraw(); | ||
| 19 | + | ||
| 20 | + canvas2.beginDraw(); | ||
| 21 | + canvas2.background(170); | ||
| 22 | + canvas2.ellipse(mouseX, mouseY, 50, 50); | ||
| 23 | + canvas2.endDraw(); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + void keyPressed() { | ||
| 27 | + GLW.getFocusedWindow().setVisible(false); | ||
| 28 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments