Is there any way in Android to use a GLSurfaceView to display the camera preview, while using OpenGL effects on that surface? Specifically additive blending effects. I know OpenGL can use the effects, and I know the camera can be placed on a SurfaceView, but can a camera be placed in a GLSurfaceView and have OpenGL blending effects applied to that camera preview?
Asked
Active
Viewed 5,210 times
10
2 Answers
5
You can use camera preview to get the raw pixels of camera frames, then upload it to a texture, and then you can do any effects you want. Try looking at this: Android Camera OpenGL ES Tutorial (android camera support is quite buggy though, it almost never works when used this way).

the swine
- 10,713
- 7
- 58
- 100
-
@Patrick D have u resolved your issue using this openGl can u share any tutorial or references to apply live camera filters – Erum Nov 11 '14 at 07:18
-
Do reference any android & opengl camera – NovusMobile Jul 08 '15 at 10:26
-
@AndroEmbedded whatever do you mean? – the swine Jul 10 '15 at 09:03
-
@theswine I followed the Android Camera OpenGL ES tutorial.Yes..it's buggy>So, do you have any reference for this ? – NovusMobile Jul 13 '15 at 05:07
1
This is untested so far, but Camera.setPreviewTexture
looks like it was designed for just this kind of job. It directly uses an OpenGL ES texture as the target of preview images, so you can do anything a shader can do with such a texture.

MvG
- 57,380
- 22
- 148
- 276