- if(!cur_fbo)
- get(GL_VIEWPORT, sys_viewport);
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id);
- cur_fbo = this;
- if(width && height)
- viewport(0, 0, width, height);
+ const Framebuffer *old = current();
+ if(set_current(this))
+ {
+ if(!old)
+ get(GL_VIEWPORT, sys_viewport);
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id);
+ if(width && height)
+ viewport(0, 0, width, height);
+ }