| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b700cf5 commit 7f909db
24 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,10 +26,8 @@ PFont font; | |||
| 26 | 26 | float fontSize = 1.5; | |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | - public void setup() { | ||
| 30 | - size(640, 480, P3D); | ||
| 31 | - // Or run full screen, more fun! Use with Sketch -> Present | ||
| 32 | - //size(screen.width, screen.height, OPENGL); | ||
| 29 | + void setup() { | ||
| 30 | + size(640, 480, P2D); | ||
| 33 | 31 | ||
| 34 | 32 | // Uses the default video input, see the reference if this causes an error | |
| 35 | 33 | video = new Capture(this, 160, 120); | |
@@ -59,7 +57,7 @@ public void setup() { | |||
| 59 | 57 | } | |
| 60 | 58 | ||
| 61 | 59 | ||
| 62 | - public void captureEvent(Capture c) { | ||
| 60 | + void captureEvent(Capture c) { | ||
| 63 | 61 | c.read(); | |
| 64 | 62 | } | |
| 65 | 63 | ||
@@ -76,6 +74,7 @@ void draw() { | |||
| 76 | 74 | textFont(font, fontSize); | |
| 77 | 75 | ||
| 78 | 76 | int index = 0; | |
| 77 | + video.loadPixels(); | ||
| 79 | 78 | for (int y = 1; y < video.height; y++) { | |
| 80 | 79 | ||
| 81 | 80 | // Move down for next line | |
@@ -127,7 +126,7 @@ void draw() { | |||
| 127 | 126 | * 'g' grabs an image and saves the frame to a tiff image | |
| 128 | 127 | * 'f' and 'F' increase and decrease the font size | |
| 129 | 128 | */ | |
| 130 | - public void keyPressed() { | ||
| 129 | + void keyPressed() { | ||
| 131 | 130 | switch (key) { | |
| 132 | 131 | case 'g': saveFrame(); break; | |
| 133 | 132 | case 'c': cheatScreen = !cheatScreen; break; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ Capture video; | |||
| 15 | 15 | ||
| 16 | 16 | void setup() { | |
| 17 | 17 | // Change size to 320 x 240 if too slow at 640 x 480 | |
| 18 | - size(640, 480); | ||
| 18 | + size(640, 480, P2D); | ||
| 19 | 19 | ||
| 20 | 20 | video = new Capture(this, width, height); | |
| 21 | 21 | video.start(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ int numPixels; | |||
| 15 | 15 | Capture video; | |
| 16 | 16 | ||
| 17 | 17 | void setup() { | |
| 18 | - size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480 | ||
| 18 | + size(640, 480, P2D); // Change size to 320 x 240 if too slow at 640 x 480 | ||
| 19 | 19 | strokeWeight(5); | |
| 20 | 20 | // Uses the default video input, see the reference if this causes an error | |
| 21 | 21 | video = new Capture(this, width, height); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ import processing.video.*; | |||
| 11 | 11 | Capture video; | |
| 12 | 12 | ||
| 13 | 13 | void setup() { | |
| 14 | - size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480 | ||
| 14 | + size(640, 480, P2D); // Change size to 320 x 240 if too slow at 640 x 480 | ||
| 15 | 15 | // Uses the default video input, see the reference if this causes an error | |
| 16 | 16 | video = new Capture(this, width, height); | |
| 17 | 17 | video.start(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,8 +20,8 @@ int[] bright; | |||
| 20 | 20 | int increment = 5; | |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | - public void setup() { | ||
| 24 | - size(800, 600, P3D); | ||
| 23 | + void setup() { | ||
| 24 | + size(800, 600, P2D); | ||
| 25 | 25 | ||
| 26 | 26 | noCursor(); | |
| 27 | 27 | // Uses the default video input, see the reference if this causes an error | |
@@ -39,9 +39,10 @@ public void setup() { | |||
| 39 | 39 | } | |
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | - public void draw() { | ||
| 42 | + void draw() { | ||
| 43 | 43 | if (video.available()) { | |
| 44 | 44 | video.read(); | |
| 45 | + video.loadPixels(); | ||
| 45 | 46 | ||
| 46 | 47 | background(0); | |
| 47 | 48 | noStroke(); | |
@@ -85,7 +86,7 @@ public void draw() { | |||
| 85 | 86 | } | |
| 86 | 87 | ||
| 87 | 88 | ||
| 88 | - public void keyPressed() { | ||
| 89 | + void keyPressed() { | ||
| 89 | 90 | if (key == 'g') { | |
| 90 | 91 | saveFrame(); | |
| 91 | 92 | } else if (key == 'c') { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,26 +3,26 @@ | |||
| 3 | 3 | class Tuple { | |
| 4 | 4 | float x, y, z; | |
| 5 | 5 | ||
| 6 | - public Tuple() { } | ||
| 6 | + Tuple() { } | ||
| 7 | 7 | ||
| 8 | - public Tuple(float x, float y, float z) { | ||
| 8 | + Tuple(float x, float y, float z) { | ||
| 9 | 9 | set(x, y, z); | |
| 10 | 10 | } | |
| 11 | 11 | ||
| 12 | - public void set(float x, float y, float z) { | ||
| 12 | + void set(float x, float y, float z) { | ||
| 13 | 13 | this.x = x; | |
| 14 | 14 | this.y = y; | |
| 15 | 15 | this.z = z; | |
| 16 | 16 | } | |
| 17 | 17 | ||
| 18 | - public void target(Tuple another, float amount) { | ||
| 18 | + void target(Tuple another, float amount) { | ||
| 19 | 19 | float amount1 = 1.0 - amount; | |
| 20 | 20 | x = x*amount1 + another.x*amount; | |
| 21 | 21 | y = y*amount1 + another.y*amount; | |
| 22 | 22 | z = z*amount1 + another.z*amount; | |
| 23 | 23 | } | |
| 24 | 24 | ||
| 25 | - public void phil() { | ||
| 25 | + void phil() { | ||
| 26 | 26 | fill(x, y, z); | |
| 27 | 27 | } | |
| 28 | 28 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,8 +19,8 @@ int[] bright; | |||
| 19 | 19 | int increment = 5; | |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | - public void setup() { | ||
| 23 | - size(800, 600, P3D); | ||
| 22 | + void setup() { | ||
| 23 | + size(800, 600, P2D); | ||
| 24 | 24 | ||
| 25 | 25 | noCursor(); | |
| 26 | 26 | // Uses the default video input, see the reference if this causes an error | |
@@ -38,9 +38,10 @@ public void setup() { | |||
| 38 | 38 | } | |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | - public void draw() { | ||
| 41 | + void draw() { | ||
| 42 | 42 | if (video.available()) { | |
| 43 | 43 | video.read(); | |
| 44 | + video.loadPixels(); | ||
| 44 | 45 | ||
| 45 | 46 | background(0); | |
| 46 | 47 | noStroke(); | |
@@ -84,7 +85,7 @@ public void draw() { | |||
| 84 | 85 | } | |
| 85 | 86 | ||
| 86 | 87 | ||
| 87 | - public void keyPressed() { | ||
| 88 | + void keyPressed() { | ||
| 88 | 89 | if (key == 'g') { | |
| 89 | 90 | saveFrame(); | |
| 90 | 91 | } else if (key == 'c') { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,26 +3,26 @@ | |||
| 3 | 3 | class Tuple { | |
| 4 | 4 | float x, y, z; | |
| 5 | 5 | ||
| 6 | - public Tuple() { } | ||
| 6 | + Tuple() { } | ||
| 7 | 7 | ||
| 8 | - public Tuple(float x, float y, float z) { | ||
| 8 | + Tuple(float x, float y, float z) { | ||
| 9 | 9 | set(x, y, z); | |
| 10 | 10 | } | |
| 11 | 11 | ||
| 12 | - public void set(float x, float y, float z) { | ||
| 12 | + void set(float x, float y, float z) { | ||
| 13 | 13 | this.x = x; | |
| 14 | 14 | this.y = y; | |
| 15 | 15 | this.z = z; | |
| 16 | 16 | } | |
| 17 | 17 | ||
| 18 | - public void target(Tuple another, float amount) { | ||
| 18 | + void target(Tuple another, float amount) { | ||
| 19 | 19 | float amount1 = 1.0 - amount; | |
| 20 | 20 | x = x*amount1 + another.x*amount; | |
| 21 | 21 | y = y*amount1 + another.y*amount; | |
| 22 | 22 | z = z*amount1 + another.z*amount; | |
| 23 | 23 | } | |
| 24 | 24 | ||
| 25 | - public void phil() { | ||
| 25 | + void phil() { | ||
| 26 | 26 | fill(x, y, z); | |
| 27 | 27 | } | |
| 28 | 28 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ int[] previousFrame; | |||
| 13 | 13 | Capture video; | |
| 14 | 14 | ||
| 15 | 15 | void setup() { | |
| 16 | - size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480 | ||
| 16 | + size(640, 480, P2D); // Change size to 320 x 240 if too slow at 640 x 480 | ||
| 17 | 17 | // Uses the default video input, see the reference if this causes an error | |
| 18 | 18 | video = new Capture(this, width, height); | |
| 19 | 19 | video.start(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + // Currently broken with the P2D renderer. | ||
| 2 | + | ||
| 1 | 3 | /** | |
| 2 | 4 | * Framingham | |
| 3 | 5 | * by Ben Fry. | |
@@ -18,7 +20,7 @@ int[] scoot; | |||
| 18 | 20 | ||
| 19 | 21 | ||
| 20 | 22 | void setup() { | |
| 21 | - size(640, 480, P3D); | ||
| 23 | + size(640, 480, P2D); | ||
| 22 | 24 | ||
| 23 | 25 | // Uses the default video input, see the reference if this causes an error | |
| 24 | 26 | video = new Capture(this, 160, 120); | |
@@ -39,6 +41,7 @@ void draw() { | |||
| 39 | 41 | // By using video.available, only the frame rate need be set inside setup() | |
| 40 | 42 | if (video.available()) { | |
| 41 | 43 | video.read(); | |
| 44 | + video.loadPixels(); | ||
| 42 | 45 | set(video.width*column, video.height*lastRow, video); | |
| 43 | 46 | column++; | |
| 44 | 47 | if (column == columnCount) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments