Browse Source

libobs-opengl: Fix bug switching render targets

If a render target was switched from one to another and then back
consecutively, the texture would not get reattached at the last point
due to the fact that the cur_render_target variable of the FBO storage
structure would already be set to that texture, and then it would never
get reattached because it thought it was already using that render
target.

So to fix this, any time a render target legitimately changes from one
to another, it sets the cur_render_target and cur_zstencil_buffer
variables of the FBO structure to null.
jp9000 10 years ago
parent
commit
2abf7b057a
1 changed files with 5 additions and 0 deletions
  1. 5 0
      libobs-opengl/gl-subsystem.c

+ 5 - 0
libobs-opengl/gl-subsystem.c

@@ -658,6 +658,11 @@ static bool set_current_fbo(gs_device_t *device, struct fbo_info *fbo)
 		GLuint fbo_obj = fbo ? fbo->fbo : 0;
 		if (!gl_bind_framebuffer(GL_DRAW_FRAMEBUFFER, fbo_obj))
 			return false;
+
+		if (device->cur_fbo) {
+			device->cur_fbo->cur_render_target = NULL;
+			device->cur_fbo->cur_zstencil_buffer = NULL;
+		}
 	}
 
 	device->cur_fbo = fbo;