Exemple #1
0
        public void resize(int width, int height)
        {
            m_width  = width;
            m_height = height;
            for (int i = 0; i < m_color.Count; ++i)
            {
                m_color[i].resize(m_width, m_height);
            }

            if (m_depth != null)
            {
                m_depth.resize(m_width, m_height);
            }

            // rebind the textures
            glBindFramebuffer(OpenGL.GL_FRAMEBUFFER_EXT, framebufferId[0]);
            for (int i = 0; i < m_color.Count; ++i)
            {
                glFramebufferTexture2D(OpenGL.GL_FRAMEBUFFER_EXT,
                                       attachment_id[i], OpenGL.GL_TEXTURE_2D, m_color[i].glID(), 0);
            }
            if (m_depth != null)
            {
                glFramebufferTexture2D(OpenGL.GL_FRAMEBUFFER_EXT,
                                       OpenGL.GL_DEPTH_ATTACHMENT_EXT, OpenGL.GL_TEXTURE_2D, m_depth.glID(), 0);
            }
            // check status
            uint result = glCheckFramebufferStatus(OpenGL.GL_FRAMEBUFFER_EXT);

            if (result != OpenGL.GL_FRAMEBUFFER_COMPLETE_EXT)
            {
                throw new Exception("Failed to create frame buffer object!");
            }
            glBindFramebuffer(OpenGL.GL_FRAMEBUFFER_EXT, 0);
        }