如何通过ndk将android相机框架加载到opengl es纹理中? [英] how to load android camera frame into opengl es texture via ndk?

查看:219
本文介绍了如何通过ndk将android相机框架加载到opengl es纹理中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在研究opengl es,并尝试在android平台上访问相机.我需要做的就是通过ndk逐帧加载相机数据,然后将其加载到GL纹理中以进行进一步处理. 有什么帮助或建议吗? 如果有示例代码,我们将不胜感激! 谢谢!

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!

推荐答案

将相机输出发送到SurfaceTexture.每个框架都可以作为外部" GLES纹理使用.这比在缓冲区中接收摄像机帧并使用glTexImage2D()手动上传摄像机帧更为有效.

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().

有关多个示例,请参见Grafika( https://github.com/google/grafika ).那里的代码是用Java语言编写的,但是GLES在Java或C/C ++中基本上是相同的.

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++.

这篇关于如何通过ndk将android相机框架加载到opengl es纹理中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆