mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Add the iOS framebuffer binder from @braindx
This commit is contained in:
parent
c0ad5b8f26
commit
ff904fc51e
|
@ -125,7 +125,32 @@ namespace opengl {
|
|||
Bind m_bind;
|
||||
};
|
||||
|
||||
typedef CachedBind<decltype(GET_GL_FUNCTION(glBindFramebuffer))> CachedBindFramebuffer;
|
||||
class CachedBindFramebuffer : public Cached2<graphics::Parameter, graphics::ObjectHandle>
|
||||
{
|
||||
public:
|
||||
CachedBindFramebuffer(decltype(GET_GL_FUNCTION(glBindFramebuffer)) _bind) : m_bind(_bind) {}
|
||||
|
||||
void bind(graphics::Parameter _target, graphics::ObjectHandle _name) {
|
||||
#ifdef OS_IOS
|
||||
if (m_defaultFramebuffer == graphics::ObjectHandle::null) {
|
||||
GLint defaultFramebuffer;
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFramebuffer);
|
||||
m_defaultFramebuffer = graphics::ObjectHandle(defaultFramebuffer);
|
||||
}
|
||||
if (_name == graphics::ObjectHandle::null) {
|
||||
_name = m_defaultFramebuffer;
|
||||
}
|
||||
#endif
|
||||
if (update(_target, _name))
|
||||
m_bind(GLenum(_target), GLuint(_name));
|
||||
}
|
||||
|
||||
private:
|
||||
decltype(GET_GL_FUNCTION(glBindFramebuffer)) m_bind;
|
||||
#ifdef OS_IOS
|
||||
graphics::ObjectHandle m_defaultFramebuffer;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef CachedBind<decltype(GET_GL_FUNCTION(glBindRenderbuffer))> CachedBindRenderbuffer;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user