适应Grafika RecordFBOActivity与Android GPUImage工作 [英] Adapting Grafika RecordFBOActivity to work with Android GPUImage

查看:1665
本文介绍了适应Grafika RecordFBOActivity与Android GPUImage工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用的Andr​​oid端口中的OpenGL渲染和管理应用程序几个过滤器。

I have an application that is using the Android port of GPUImage as the OpenGL Renderer and manager of several filters.

目前,它不具有视频实现,所以我想从的谷歌grafika库与GPUImage架构工作。

It currently does not have a video implementation, so I am trying to adapt the RecordFBOActivity from the Google grafika repository to work with the GPUImage architecture.

基GPUImage类管理GLContext和GLSurfaceView和GPUImageRenderer类实现了渲染器类。

The base GPUImage class manages the GLContext and GLSurfaceView, and the GPUImageRenderer class implements the Renderer class.

这是我想从grafika的RecordFBOActivity适应RenderThread类。有几个问题。

This is the class where I am trying to adapt the RenderThread from the RecordFBOActivity of grafika. There are a few problems.

第一 preparegl()的方法,我传递的表面纹理的而不是表面,为的 GPUImage 的未使用的 SurfaceHolder 的所有(我想我可以实现它,但我尽量不改变基本code太多,因为我想对我实施逼退上述回购)。我知道的 WindowSurface.java 的有一个重载的方法构建的 WindowSurface 的从的表面纹理的以及曲面,但如果我这样做的的 mSurface 的伊娃总是空,因为我从来没有一个表面传递给它,这将导致在 makeCurrent()的记录方法。

First, in the preparegl() method, I am passing a SurfaceTexture instead of a Surface, as GPUImage doesn't use the SurfaceHolder at all (I think I can implement it, but am trying not to change the base code too much, as i would like to push back my implementation to the aforementioned repo). I know that WindowSurface.java has an overloaded method to construct a WindowSurface from a SurfaceTexture as well as a Surface, but if I do this the mSurface iVar is always null, as I never have a surface to pass to it, which causes a NPE in the makeCurrent() method of recording.

GPUImage 的附着于一个 GLSurfaceView 的,不是的 SurfaceView 的像grafika示例使用,所以我有点不确定的,如果有任何低级别的不一致可能导致冲突,我...

Second, GPUImage attaches itself to a GLSurfaceView, not a SurfaceView like the grafika example uses, so I'm a little uncertain if there are any low level inconsistencies that may be causing conflicts for me...

第三,我认为这是主要的问题,至少在那一刻,是我似乎无法调和的 GPUImage 与 WindowSurface 的grafika的。如果我注释掉的 prepareGl()的方法时,的 setUpSurfaceTexture()的的的 GPUImage 的设置相机的preVIEW质感从表面纹理的由的 glGenTextures创建()的和preVIEW工作正常..以及被附着在过滤器渲染链。但是,如果我尝试调用的 prepareGL()的方法,并通过完全相同的表面纹理的到的 mWindowSurface 的的构造函数中,相机服务死了,我得到的 EGL_BAD_SURFACE 的错误。

Third, and I think this is the main issue, at least at the moment, is that I can't seem to reconcile the camera preview of GPUImage with the WindowSurface of grafika. If I comment out the prepareGl() method, the setUpSurfaceTexture() of GPUImage sets the preview texture of the camera from the SurfaceTexture that is created by glGenTextures() and the preview works fine.. as well as being attached to the filter render chain. However, if I try to call the prepareGL() method, and pass the exact same SurfaceTexture to the constructor of mWindowSurface, the camera service dies and i get a EGL_BAD_SURFACE error.

长的问题,具有运动部件少,我知道......会尝试编辑/更新,我可以澄清问题和办法,以自己。但是,如果任何人有任何想法/审讯......特别@fadden会喜欢:D

Long question, with a few moving parts, I know... Will attempt to edit/update as I can clarify issues and approaches to myself. But would love if anyone has any thoughts/interrogations... particularly @fadden :D

推荐答案

我也想实现同样的事情,并试图什么法登曾建议。试图整合 CameraSurfaceRenderer 功能 GPUImageRenderer 。在preVIEW是好的,但录音仅仅是一个黑帧的视频。 EGL14.eglGetCurrentContext()收益为下面的调用和我的猜测是,如果创建一个新的上下文也不会一样是什么 GPUImage 可能

I was also trying to achieve the same thing and have tried what fadden has suggested. Tried to integrate CameraSurfaceRenderer functionality to GPUImageRenderer. The preview is fine but the recording is just a video with black frames. EGL14.eglGetCurrentContext() returns null for following call and my guess is if a new context is created it will not be same as what GPUImage might have

mVideoEncoder.startRecording(new TextureMovieEncoder.EncoderConfig(
                                    mOutputFile, 640, 480, 1000000, EGL14.eglGetCurrentContext()));

@ Jesses.co.tt是你能实现吗?

@Jesses.co.tt were you able to achieve it?

(我不能添加评论它添加为一个答案)。

(as I can't add comment it is added as an answer).

这篇关于适应Grafika RecordFBOActivity与Android GPUImage工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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