如何在 iOS 中复制 OpenGL ES 帧缓冲区?
我想将 OpenGL ES 帧缓冲区从视频 RAM 复制到我的 iOS 游戏中的视频 RAM。这是怎么做到的?
理想情况下,我每秒执行 30 次。然后将复制缓冲区的内容分段传输到 CPU(不是一次全部传输,因为这会导致游戏卡顿)。
I'd like to copy the OpenGL ES framebuffer from video RAM to video RAM in my iOS game. How is this done?
Ideally I'll do this 30 times per second. Then transfer the contents of the copied buffer to the CPU piecewise (not all at once since this causes a stutter in the game).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:我想说你应该看看帧缓冲区对象(FBO),你可以在以下帖子中找到一个示例:
https://devforums.apple.com/message/23282#23282
这将允许您将场景渲染为附加到 FBO 的纹理,然后使用该纹理。
PS:感谢 Christian 指出我的错误(我第一次读到 MrMusic 想要将 VRAM 复制到 RAM,并错误地建议使用 glReadPixels,这确实不适合该目的)。
EDIT: I would say that you should have a look into Frame Buffer Objects (FBOs), you can find an example on the following post:
https://devforums.apple.com/message/23282#23282
This will allow you to render your scene into a texture attached to a FBO and use the texture afterwards.
PS: Thanks Christian for pointing out my mistake (I first read that MrMusic wanted to copy VRAM to RAM and wrongly suggested to use glReadPixels which is indeed unsuitable for that purpose).