--- /dev/null
+#include <msp/gl/extensions/ext_framebuffer_object.h>
+#include "gl.h"
+#include "systemframebuffer.h"
+
+namespace Msp {
+namespace GL {
+
+OpenGLSystemFramebuffer::OpenGLSystemFramebuffer():
+ Framebuffer(true)
+{
+ FrameFormat sys_format;
+
+ if(EXT_framebuffer_object)
+ {
+ int value;
+ glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value);
+ if(value==GL_NONE)
+ glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_FRONT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value);
+ if(value!=GL_NONE)
+ sys_format = (sys_format, COLOR_ATTACHMENT);
+
+ glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value);
+ if(value!=GL_NONE)
+ sys_format = (sys_format, DEPTH_ATTACHMENT);
+
+ glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value);
+ if(value!=GL_NONE)
+ sys_format = (sys_format, STENCIL_ATTACHMENT);
+ }
+ else
+ // Make a guess if we can't query the format
+ sys_format = (COLOR_ATTACHMENT, DEPTH_ATTACHMENT);
+
+ set_system_format(sys_format);
+}
+
+void OpenGLSystemFramebuffer::resize(unsigned w, unsigned h)
+{
+ resize_system(w, h);
+}
+
+} // namespace GL
+} // namespace Msp