如何在2个OpenGL上下文之间共享纹理?
我通过绘制离屏纹理(由离屏帧缓冲区创建)成功渲染了我的 OpenGL 视图。
draw -> offscreen FBO/Texture ------> onscreen FBO ---> render buffer -> context
现在我想重用屏幕外纹理来渲染另一个 OpenGL 上下文。
draw -> offscreen FBO/Texture ----> onscreen FBO ---> render buffer -> context
\----> onscreen FBO2---> render buffer2 ->context 2
我尝试过,但无法将任何内容渲染到上下文 2。 有人遇到这个问题,并且知道如何配置共享纹理吗?
谢谢!
更新: 我刚刚创建了一个简单的项目,描述了我使用帧缓冲区和双上下文所做的事情。 http://www.mediafire.com/?vxv1bubzvio4q7h
I'm rendering successfully my OpenGL view by drawing an offscreen texture (which is created by an offscreen framebuffer).
draw -> offscreen FBO/Texture ------> onscreen FBO ---> render buffer -> context
Now I want to reuse offscreen texture to render another OpenGL context.
draw -> offscreen FBO/Texture ----> onscreen FBO ---> render buffer -> context
\----> onscreen FBO2---> render buffer2 ->context 2
I tried but can not render anything to context 2.
Anyone got this issue, and know how to configure to share texture?
Thanks!
UPDATE:
I've just created a simple project describing what I'm doing with Framebuffer and double contexts.
http://www.mediafire.com/?vxv1bubzvio4q7h
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将使用 EAGLSharegroup。您可以在这些链接上阅读相关内容。
https://developer.apple.com/library/ios/#qa /qa1612/_index.html
https://developer.apple.com/library/ios/#documentation/OpenGLES/Reference/EAGLSharegroup_ClassRef/Reference/EAGLSharegroup.html
https://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/ConcurrencyandOpenGLES/ConcurrencyandOpenGLES.html
You will use EAGLSharegroup. You can read about it on these links.
https://developer.apple.com/library/ios/#qa/qa1612/_index.html
https://developer.apple.com/library/ios/#documentation/OpenGLES/Reference/EAGLSharegroup_ClassRef/Reference/EAGLSharegroup.html
https://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/ConcurrencyandOpenGLES/ConcurrencyandOpenGLES.html
我意识到你正在尝试共享纹理,而我没有,但我提供这个答案是因为你的症状似乎与我的相同......
就我而言,绑定纹理时我也得到了 GL_INVALID_VALUE。事实证明,在为其创建纹理之前我没有切换到第二个上下文。因此,它们是在第一个上下文中创建的。然而,我的渲染切换了上下文,因此无法找到纹理。
I realise that you are trying to share the textures and I am not, but I offer this answer as your symptom seems to be the same as mine...
In my case, I was also getting an GL_INVALID_VALUE when binding the texture. It turned out that I wasn't switching to the second context prior to creating the textures for it. Thus they were being created in the first context. My render, however WAS switching contexts and therefore failing to find the textures.