Skip to content

Commit d6a2953

Browse files
committed
Conflicts: README.md
2 parents 198e5a9 + 14eb6e1 commit d6a2953

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Processing Video implementation for Android
2-
In this branch, I'm maintaing another approach to render camera preview on processing's `GLSurfaceView`.
2+
In this branch, I'm maintaining another approach to render camera preview on processing's `GLSurfaceView`.
33
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`.
44
We cannot directly render to processing's own texture because it's bound `GL_TEXTURE_2D` target, whereas for the preview to happen, the texture should be bound to `GL_TEXTURE_EXTERNAL_OES`.
55

66
**Behind the hood :**
77

8-
I create a framebuffer object and a custom texture object, which is bound to target `GL_TEXTURE_2D`, and attach this texture to the previously created framebuffer at `GL_COLOR_ATTACHMENT0`. I then render SurfaceTexture's shader output to this framebuffer and it atomatically gets rendered upon the custom texture I created. I then follow the approach as being done in the Syphon library - https://github.com/Syphon/Processing/blob/master/Processing_2_0/src/codeanticode/syphon/SyphonClient.java#L271
8+
I create a framebuffer object and a custom texture object, which is bound to target `GL_TEXTURE_2D`, and attach this texture to the previously created framebuffer at `GL_COLOR_ATTACHMENT0`. I then render SurfaceTexture's shader output to this framebuffer and it atomatically gets rendered upon the custom texture I created. I then call `glReadPixels` and assign these read pixels to `PImage`'s pixel array.
9+
10+
For an alternative approach, please head over to testing branch.

0 commit comments

Comments
 (0)