I want to use the OpenGL ES for the Android camera preview and Save the captured Image.
I like to use the OpenGL ES in Android camera to give some effect to the Android camera. So please anyone tell me how to do it?
I want to use the OpenGL ES for the Android camera preview and Save the captured Image.
I like to use the OpenGL ES in Android camera to give some effect to the Android camera. So please anyone tell me how to do it?
you need to implement the android.hardware.Camera.PreviewCallback
interface and override the method
public synchronized void onPreviewFrame(byte[] data, Camera camera) {
myOpenGLObject.receiveFrames(data);
}
to read the frames received from the camera callback. I suggest you to have a look into the andar source http://code.google.com/p/andar/. Especially the class CameraPreviewHandler.java.
I hope this answers your question.
A faster way is to avoid the onPreviewFrame
callback and use SurfaceTexture
as the texture to which the camera renders the preview.
Have a look at the example inside grafika which more or less does the same : https://github.com/google/grafika/blob/master/src/com/android/grafika/CameraCaptureActivity.java