@@ -51,8 +51,9 @@ ImVec2 GLRenderCtx::size() const {
5151}
5252
5353bool GLRenderCtx::begin () {
54- // save currently bound fbo
54+ // save currently bound fbo and rbo
5555 glGetIntegerv (GL_FRAMEBUFFER_BINDING, &m_prevDrawBuffer);
56+ glGetIntegerv (GL_RENDERBUFFER_BINDING, &m_prevReadBuffer);
5657
5758 if (!m_buffer) {
5859 glGenFramebuffers (1 , &m_buffer);
@@ -76,6 +77,8 @@ bool GLRenderCtx::begin() {
7677 0 ,GL_RGB, GL_UNSIGNED_BYTE, 0
7778 );
7879
80+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
81+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
7982 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
8083 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
8184 }
@@ -106,7 +109,8 @@ bool GLRenderCtx::begin() {
106109
107110void GLRenderCtx::end () {
108111
109- // bind the framebuffer that was bound before us
112+ // bind the renderbuffer and framebuffer that was bound before us
113+ glBindRenderbuffer (GL_RENDERBUFFER, m_prevReadBuffer);
110114 glBindFramebuffer (GL_FRAMEBUFFER, m_prevDrawBuffer);
111115 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
112116 // glFlush();
0 commit comments