iOS应用程序的快速屏幕录制 [英] Fast Screen Recording of iOS App
问题描述
我是OpenGL ES的新手. 我正在尝试编写代码来录制iOS应用程序(尤其是游戏)的屏幕.
I'm new to OpenGL ES. I'm trying to write code for screen recording of iOS apps, especially games.
我正在使用此答案中的代码描述的渲染到纹理"方法来捕获屏幕并编写cocos2d游戏的视频.
我所做的一个修改是,当我调用CVOpenGLESTextureCacheCreate
时,我正在使用
[EAGLContext currentContext]
代替
I'm using the 'render to texture' method described with code in this answer to capture screen and write the video for a cocos2d game.
One modification I made was that, when I call CVOpenGLESTextureCacheCreate
then I'm using
[EAGLContext currentContext]
instead of
[[GPUImageOpenGLESContext sharedImageProcessingOpenGLESContext] context]
它确实录制了视频,但是有两个问题
It does record the video but there are two issues
(1)-开始记录时,屏幕上的新图形将停止.我也希望该应用程序继续在屏幕上绘图.由于我是OpenGL ES的新手,所以我对帧缓冲区对象等没有深刻的了解,因此很难弄清楚如何在屏幕上同时绘制和捕获屏幕.在这方面,我将感谢一个代码示例.
(1)- When it starts recording then new drawing on the screen stops. I want the app to keep on drawing on the screen too. As I'm new to OpenGL ES, I don't have deep understanding of frame buffer objects etc., so I have a hard time figuring out how to simultaneously draw on screen and capture the screen as well. I'll appreciate a code example in this regard.
(2)-录制的视频上下颠倒.如何获得正确的方向?
(2)- The recorded video is flipped upside down. How can I get it in correct direction?
以前,我也考虑过glReadPixels
方法,但这存在性能缺陷.
Previously I considered glReadPixels
method too, but that has performance drawbacks.
更新:也想到了一些想法.根据我的一点理解,
Update: a couple of ideas also came to mind. According to my little understanding,
我可以简单地将纹理绘制回屏幕,但不知道如何.
I could simply draw my texture back to screen, but don't know how.
OR
我可以有一个辅助FBO,并且可以在其上附加纹理,即
I could have a secondary FBO and I could attach the texture to it, i.e.
glGenFramebuffersOES(1, &textureFrameBuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, textureFrameBuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, CVOpenGLESTextureGetName(renderTexture), 0);
//Then I restore the screen FBO.
glBindFramebufferOES(GL_FRAMEBUFFER_OES, 1);
但是,如果我这样做了,那么如何将屏幕图形复制到我的辅助FBO中?
But if I do that, then how do I copy the screen-drawing to my secondary FBO?
推荐答案
有现成的解决方案,因此,如果您不想重新发明轮子,可以尝试Everyplay(
There are readymade solutions for this, so if you're not looking to re-invent the wheel, you can try out Everyplay (https://everyplay.com/about).
在OpenGL级别记录屏幕的文档可以在以下位置找到: https://developers.everyplay.com/doc/Everyplay-integration-to-iOS-game
The documentation for recording the screen from the OpenGL level can be found here: https://developers.everyplay.com/doc/Everyplay-integration-to-iOS-game
免责声明:我为制作Everyplay的公司工作
Disclaimer: I work for the company that makes Everyplay
这篇关于iOS应用程序的快速屏幕录制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!