Skip to content

Commit a6fdd2d

Browse files
committed
Update example in README
1 parent a08ae4b commit a6fdd2d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ Capture cap;
99
1010
void setup() {
1111
size(720, 1280, P2D);
12-
cap = new Capture(this);
13-
String[] list = cap.list();
12+
cap = new Capture(this, 720, 1280);
13+
String[] list = Capture.list();
14+
//Use this to print list of resolutions supported by the camera
1415
Capture.printCompatibleResolutionsList(cap);
16+
cap.setCamera(list[0]);
17+
cap.start();
1518
}
1619
1720
void draw() {
@@ -20,4 +23,5 @@ void draw() {
2023
```
2124

2225
**Behind the hood :**
26+
2327
The idea is to render camera preview on a `SurfaceTexture` and as soon as the new frame is received, copy the data from this `SurfaceTexture` to a custom texure bound to target `GL_TEXTURE_2D` (Note : We cannot directly render to a texture bound to `GL_TEXTURE_2D` target, because for the preview to happen, the texture must be bound to `GL_TEXTURE_EXTERNAL_OES`). This custom texture is then rendered to a PGraphics object. The backing texture of that PGraphics object is then used as the texture cache for our PImage file which stores the video.

0 commit comments

Comments
 (0)