In my project, I use alot of direct non-Qt OpenGL calls.

At some point during startup I want an opportunity to create/load some initial OpenGL resources. To do this, I need to call QOpenGLWidget::makeCurrent(),

My problem is, I can't call "QOpenGLWidget::makeCurrent()" until after application.exec() is entered. Is there some way I can force my QMainWindow's child QOpenGLWidgets to be initialized before application.exec() is entered?

=
Qt Code:
  1. MainWindow mainWindow(argc, argv);
  2. if(!mainWindow.Initialize()) //I'd really like to load my OpenGL resources here...
  3. {
  4. return EXIT_FAILURE;
  5. }
  6.  
  7. return application.exec(); //But QOpenGLWidget hasn't created the OpenGL context until this is entered.
To copy to clipboard, switch view to plain text mode