Make sure that m_buffer is large enough to hold raw image.
Added check for framebuffer completeness.