From 5a7167aaaf7ddd15a2668287bed96cbb209fa2b7 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 15 Apr 2021 00:49:34 -0700 Subject: [PATCH] GL spinner fix (#20684) * GL spinner fix * update larch spinner Co-authored-by: Comma Device old-commit-hash: aaa8d937f504e4240444454a32b85de6977bf8b6 --- selfdrive/ui/qt/spinner.cc | 16 ++++++++++++---- selfdrive/ui/qt/spinner_larch64 | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/selfdrive/ui/qt/spinner.cc b/selfdrive/ui/qt/spinner.cc index 087e13402f..89c1a91318 100644 --- a/selfdrive/ui/qt/spinner.cc +++ b/selfdrive/ui/qt/spinner.cc @@ -10,9 +10,7 @@ #include "spinner.hpp" #include "qt_window.hpp" -// TrackWidget - -TrackWidget::TrackWidget(QWidget *parent) { +TrackWidget::TrackWidget(QWidget *parent) : QOpenGLWidget(parent) { setFixedSize(spinner_size); setAutoFillBackground(false); @@ -56,7 +54,7 @@ Spinner::Spinner(QWidget *parent) { main_layout->setSpacing(0); main_layout->setMargin(200); - main_layout->addWidget(new TrackWidget(), 0, 0, Qt::AlignHCenter | Qt::AlignVCenter); + main_layout->addWidget(new TrackWidget(this), 0, 0, Qt::AlignHCenter | Qt::AlignVCenter); text = new QLabel(); text->setVisible(false); @@ -113,6 +111,16 @@ void Spinner::update(int n) { } int main(int argc, char *argv[]) { + QSurfaceFormat fmt; +#ifdef __APPLE__ + fmt.setVersion(3, 2); + fmt.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile); + fmt.setRenderableType(QSurfaceFormat::OpenGL); +#else + fmt.setRenderableType(QSurfaceFormat::OpenGLES); +#endif + QSurfaceFormat::setDefaultFormat(fmt); + QApplication a(argc, argv); Spinner spinner; setMainWindow(&spinner); diff --git a/selfdrive/ui/qt/spinner_larch64 b/selfdrive/ui/qt/spinner_larch64 index ffc98cf984..6912384399 100755 --- a/selfdrive/ui/qt/spinner_larch64 +++ b/selfdrive/ui/qt/spinner_larch64 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dcf0ea9e0aad69be5f31e349297454433792daabbbc228e42873f37ce3e3a742 -size 539856 +oid sha256:a62f29ddc8abe620c85140d9ba2fb4cb5c869b5aae92ff83b39960d1a82dbd03 +size 662096