| 535 | } |
| 536 | |
| 537 | void ScopyMainWindow::loadOpenGL() |
| 538 | { |
| 539 | bool disablePref = false; |
| 540 | QOpenGLContext *ct = QOpenGLContext::currentContext(); |
| 541 | if(ct) { |
| 542 | QOpenGLFunctions *glFuncs = ct->functions(); |
| 543 | bool glCtxValid = ct->isValid(); |
| 544 | QString glVersion = QString((const char *)(glFuncs->glGetString(GL_VERSION))); |
| 545 | qInfo(CAT_BENCHMARK) << "GL_VENDOR " << reinterpret_cast<const char *>(glFuncs->glGetString(GL_VENDOR)); |
| 546 | qInfo(CAT_BENCHMARK) << "GL_RENDERER " |
| 547 | << reinterpret_cast<const char *>(glFuncs->glGetString(GL_RENDERER)); |
| 548 | qInfo(CAT_BENCHMARK) << "GL_VERSION " << glVersion; |
| 549 | qInfo(CAT_BENCHMARK) << "GL_EXTENSIONS " |
| 550 | << reinterpret_cast<const char *>(glFuncs->glGetString(GL_EXTENSIONS)); |
| 551 | qInfo(CAT_BENCHMARK) << "QOpenGlContext valid: " << glCtxValid; |
| 552 | if(!glCtxValid || glVersion.compare("2.0.0", Qt::CaseInsensitive) < 0) { |
| 553 | disablePref = true; |
| 554 | } |
| 555 | } else { |
| 556 | qInfo(CAT_BENCHMARK) << "QOpenGlContext is invalid"; |
| 557 | disablePref = true; |
| 558 | } |
| 559 | |
| 560 | qInfo(CAT_BENCHMARK) << "OpenGL load status: " << !disablePref; |
| 561 | if(disablePref) { |
| 562 | Preferences::GetInstance()->set("general_use_opengl", false); |
| 563 | Preferences::GetInstance()->save(); |
| 564 | RestartDialog *restarter = new RestartDialog(this); |
| 565 | restarter->setDescription( |
| 566 | "Scopy uses OpenGL for high performance plot rendering. Valid OpenGL context (>v2.0.0) not " |
| 567 | "detected.\n" |
| 568 | "Restarting will set Scopy rendering mode to software. This option can be changed from the " |
| 569 | "Preferences " |
| 570 | "menu.\n" |
| 571 | "Please visit the <a " |
| 572 | "href=https://wiki.analog.com/university/tools/m2k/scopy-troubleshooting> Wiki " |
| 573 | "Analog page</a> for troubleshooting."); |
| 574 | connect(restarter, &RestartDialog::restartButtonClicked, [=] { |
| 575 | ApplicationRestarter::triggerRestart(); |
| 576 | restarter->deleteLater(); |
| 577 | }); |
| 578 | QMetaObject::invokeMethod(restarter, &RestartDialog::showDialog, Qt::QueuedConnection); |
| 579 | } |
| 580 | |
| 581 | delete m_glLoader; |
| 582 | m_glLoader = nullptr; |
| 583 | } |
| 584 | |
| 585 | void ScopyMainWindow::loadPluginsFromRepository() |
| 586 | { |