From b465a28fef702ccc3447de4ed33eb3940fd3e486 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Wed, 29 May 2013 13:15:07 +0000
Subject: [PATCH] fix drawing on another window to generate bitmap files on
 linux

---
 Common/CreateFile.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Common/CreateFile.cpp b/Common/CreateFile.cpp
index 8576ac0275..285af09ec8 100644
--- a/Common/CreateFile.cpp
+++ b/Common/CreateFile.cpp
@@ -152,6 +152,11 @@ static PixelBuffer *GetCompositePixelBuffer(GLenum format, GLenum type)
       (FlGui::instance()->getCurrentOpenglWindow()->getDrawContext());
     newg->show();
     openglWindow::setLastHandled(newg);
+    //waiting for the os to really make the window visible and to call the "draw" function
+    //on (some ?) linux if we do not wait here, the window is not ready
+    //and the picture cannot be generated
+    while(!newg->valid())
+      Fl::wait();
   }
 
   PixelBuffer *buffer;
-- 
GitLab