glCopyTexImage2D可以替代glReadPixels(OpenGL ES) [英] glCopyTexImage2D as alternative to glReadPixels (OpenGL ES)
问题描述
我目前正在使用glReadPixels
捕获OpenGL ES游戏的屏幕截图.屏幕截图非常棒,但是调用glReadPixels
会导致游戏中出现少量停顿现象.
glCopyTexImage2D
作为glReadPixels
的更有效替代. glCopyTexImage2D
如何工作?在某些情况下,我使用的是此Apple方法. /p>
我是OpenGL的新手,所以非常感谢您的帮助:-)
时间延迟是由于在GPU和CPU之间传输大量内存引起的.这可以通过以每帧一点的方式分块传输来解决.但是,如果您从一系列帧的帧缓冲区中读取图像,则图像将同时发生变化.
因此,您将视频RAM复制到视频RAM(非常快),然后将其复制,就不会改变.
I'm currently grabbing a screenshot of an OpenGL ES game using glReadPixels
. The screenshots are great however the call to glReadPixels
causes a small stutter in the game.
glCopyTexImage2D
has been suggested as a more efficient replacement for glReadPixels
. How does glCopyTexImage2D
work? For some context I'm using this Apple method.
I'm relatively new to OpenGL so any help is much appreciated :-)
The time delay is caused by transferring a large amount of memory between GPU and CPU. This can be solved by transferring in chunks, a little bit per frame. But if you read from the framebuffer over a series of frame, the image would be changing meanwhile.
So you make a copy, video RAM into video RAM (very fast), and then it won't change as you transfer it piecemeal.
这篇关于glCopyTexImage2D可以替代glReadPixels(OpenGL ES)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!