Skip to content

Commit f3e6d7f

Browse files
committed
Update according to the new approach
1 parent f22a859 commit f3e6d7f

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
22
In this branch, I'm maintaing 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 processing's underlying texure.
4-
We cannot directly render to processing's own texture because it's bound `GLES20.GL_TEXTURE_2D` target, whereas for the preview to happen, the texture should be bound to `GLES11Ext.GL_TEXTURE_EXTERNAL_OES`.
4+
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

6-
I create a framebuffer object and attach processing's own texture to this framebuffer at GL_COLOR_ATTACHMENT0. I then render SurfaceTexture shader output to this framebuffer and it atomatically gets drawn to processing's texture.
6+
**Behind the hood :**
7+
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.
79

810
For an alternative approach, please head over to pixel_manipulation branch.

0 commit comments

Comments
 (0)