从GLKView / GLKit获取默认帧缓冲区ID [英] Getting default frame buffer id from GLKView/GLKit

查看:333
本文介绍了从GLKView / GLKit获取默认帧缓冲区ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的IOS OpenGL ES 2.0项目中使用GLkit / GLKView来管理我的应用程序的默认FBO /生命周期。

I use GLkit/GLKView in my IOS OpenGL ES 2.0 project to manage default FBO/life cycle of my app.

在桌面OpenGL中绑定默认FBO (前缓冲区)我可以调用glBindFrameBuffer(GL_FRAMEBUFFER,0),但在IOS应用程序中不是这种情况,因为你必须自己创建默认的FBO并且它将具有唯一的ID;

In desktop OpenGL in order to bind default FBO (the front buffer) I can just call glBindFrameBuffer(GL_FRAMEBUFFER,0) but this is not the case in IOS app since you have to create the default FBO yourself and it will have a unique ID;

问题是GLKit / GLKView编码风格迫使我使用GLKView的bindDrawable函数激活默认FBO,这使得我的跨平台渲染系统的设计有点难看(必须将GLKView指针存储为void * in每次我想执行默认的FBO绑定时,我的c ++引擎类和桥接器都会抛出它。

The problem is GLKit/GLKView coding style force me to use GLKView's "bindDrawable" function to activate default FBO which make the design of my cross platform rendering system a little ugly (have to store GLKView pointer as void* in my c++ engine class and bridge cast it every time I want to perform default FBO binding)

有没有办法获得GLKit / GLKView创建的默认FBO ID,以便我可以存储并使用它来绑定我的代码中的任何位置的默认帧缓冲区吗?

Are there any way to get the default FBO ID that GLKit/GLKView create so that I can store and use it to bind default frame buffer any where in my code ?

最糟糕的是我可以恢复自己创建默认的FBO并且消除GLKit / GLKView但是这是一个很好的框架我想继续使用它。

At worst I can revert back to create the default FBO myself and dissing GLKit/GLKView but it such a nice framework that I would like to continue using it.

抱歉我的英文不好,并提前感谢您的回复。

Sorry for my bad english and thank in advance for any reply.

推荐答案

也许你可以在你的bindDrawable调用之后获得当前的帧缓冲区ID,通过调用类似的东西:

Perhaps you can get the "current" framebuffer ID just after your bindDrawable call, by calling something like:

GLint defaultFBO;
glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES, &defaultFBO);

这篇关于从GLKView / GLKit获取默认帧缓冲区ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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