diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index e6092b55fc4..48c5978c4b7 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -975,19 +975,18 @@ void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y) const int w = GPU_texture_width(ofs->color); const int h = GPU_texture_height(ofs->color); - GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs); + GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_RECT_COLOR); + GPU_shader_bind(shader); + GPU_texture_bind(ofs->color, 0); - glBindFramebuffer(GL_READ_FRAMEBUFFER, ofs_fb->object); - GLenum status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); + glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), 1.0f, 1.0f, 1.0f, 1.0f); + glUniform1i(GPU_shader_get_uniform_ensure(shader, "image"), 0); + glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_icon"), 0.0f, 0.0f, 1.0f, 1.0f); + glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_geom"), x, y, x + w, y + h); - if (status == GL_FRAMEBUFFER_COMPLETE) { - glBlitFramebuffer(0, 0, w, h, x, y, x + w, y + h, GL_COLOR_BUFFER_BIT, GL_NEAREST); - } - else { - gpu_print_framebuffer_error(status, NULL); - } + GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4); - glBindFramebuffer(GL_READ_FRAMEBUFFER, GPU_framebuffer_default()); + GPU_texture_unbind(ofs->color); } void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels)