how to load android camera frame into opengl es te

2019-04-13 03:20发布

问题:

I've been studying opengl es recently and trying to access the camera on android platform. All I need to do is to load camera data frame by frame through ndk and then load it into GL texture for further process. Is there any help or suggestion? It is highly appreciated if there is sample code! thank you!

回答1:

Send the camera output to a SurfaceTexture. Each frame will be available as an "external" GLES texture. This is significantly more efficient than receiving camera frames in a buffer and manually uploading them with glTexImage2D().

See Grafika (https://github.com/google/grafika) for multiple examples. The code there is written in the Java language, but GLES is essentially the same in Java or C/C++.