ENABLE_THUMBNAIL_GENERATOR -> Fixed flickering of 3D view when generating thumbnail

This commit is contained in:
Enrico Turri 2019-10-24 12:30:19 +02:00
parent d01532f4c6
commit 1baa333663

View file

@ -1697,10 +1697,9 @@ void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w,
glsafe(::glDisable(GL_LIGHTING)); glsafe(::glDisable(GL_LIGHTING));
glsafe(::glReadPixels(0, 0, thumbnail_data.width, thumbnail_data.height, GL_RGBA, GL_UNSIGNED_BYTE, (void*)thumbnail_data.pixels.data())); glsafe(::glReadPixels(0, 0, thumbnail_data.width, thumbnail_data.height, GL_RGBA, GL_UNSIGNED_BYTE, (void*)thumbnail_data.pixels.data()));
std::cout << "Generated thumbnail " << thumbnail_data.width << "x" << thumbnail_data.height << std::endl; // restore the framebuffer size to avoid flickering on the 3D scene
const Size& cnv_size = get_canvas_size();
// force a frame render to restore the default framebuffer m_camera.apply_viewport(0, 0, cnv_size.get_width(), cnv_size.get_height());
render();
} }
#endif // ENABLE_THUMBNAIL_GENERATOR #endif // ENABLE_THUMBNAIL_GENERATOR