if(id)
throw invalid_argument("System framebuffer must have id 0");
+ if(EXT_framebuffer_object)
+ {
+ int value;
+ glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value);
+ if(value==GL_NONE)
+ glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_FRONT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value);
+ if(value!=GL_NONE)
+ format = (format,COLOR_ATTACHMENT);
+
+ glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value);
+ if(value!=GL_NONE)
+ format = (format,DEPTH_ATTACHMENT);
+
+ glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value);
+ if(value!=GL_NONE)
+ format = (format,STENCIL_ATTACHMENT);
+ }
+
int view[4];
glGetIntegerv(GL_VIEWPORT, view);
width = view[2];
void Framebuffer::set_format(const FrameFormat &fmt)
{
- if(!format.empty())
+ if(!format.empty() || !id)
throw invalid_operation("Framebuffer::set_format");
if(fmt.empty())
throw invalid_argument("Framebuffer::set_format");