Skip to content

Commit

Permalink
[runSofa] WIP batchGUI is still not working as it should on some OS.
Browse files Browse the repository at this point in the history
  • Loading branch information
damienmarchal committed Jan 15, 2018
1 parent 5e6a271 commit c3dfac7
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions applications/sofa/gui/qt/BatchGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ BatchGUI::~BatchGUI()
int BatchGUI::mainLoop()
{
int argc=1;
char* argv[1]={"nothing"};
QGuiApplication a(argc, (&argv[0]));
const char* argv[1]={"batchGUI"};
QGuiApplication a(argc, const_cast<char**>((&argv[0])));

QSurfaceFormat surfaceFormat;
surfaceFormat.setMajorVersion(4);
Expand All @@ -62,14 +62,21 @@ int BatchGUI::mainLoop()
QOpenGLContext openGLContext;
openGLContext.setFormat(surfaceFormat);
openGLContext.create();
if(!openGLContext.isValid()) return -1;
if(openGLContext.isValid()){
QOffscreenSurface surface;
surface.setFormat(surfaceFormat);
surface.create();
if(surface.isValid()){
openGLContext.makeCurrent(&surface);
}else {
msg_warning("BatchGUI") << "Unable to get a valid openGL Surface. Some scenes may not work properly." ;
}
} else {
msg_warning("BatchGUI") << "Unable to get a valid openGL context. Some scenes may not work properly." ;
}


QOffscreenSurface surface;
surface.setFormat(surfaceFormat);
surface.create();
if(!surface.isValid()) return -2;

openGLContext.makeCurrent(&surface);

if (groot)
{
Expand Down

0 comments on commit c3dfac7

Please sign in to comment.