From 3f5d50eb63ff8b3c0cb2c70caa9fa932d6ab4b55 Mon Sep 17 00:00:00 2001 From: Ally Warner Date: Tue, 23 Jun 2020 14:10:50 -0600 Subject: [PATCH 1/6] Enable High Resolution --- src/CMake/Modules/MacOSXBundleInfo.plist.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMake/Modules/MacOSXBundleInfo.plist.in b/src/CMake/Modules/MacOSXBundleInfo.plist.in index 5eb624c7f..bbb532dd7 100644 --- a/src/CMake/Modules/MacOSXBundleInfo.plist.in +++ b/src/CMake/Modules/MacOSXBundleInfo.plist.in @@ -33,7 +33,7 @@ NSHumanReadableCopyright ${MACOSX_BUNDLE_COPYRIGHT} NSHighResolutionCapable - + CFBundleDocumentTypes From 04986ed6654971a75cfdc095b0b9c1fbab055169 Mon Sep 17 00:00:00 2001 From: Ally Warner Date: Thu, 6 Aug 2020 16:28:16 -0600 Subject: [PATCH 2/6] This is the plist file that works There should only be one plist file. --- src/Resources/info.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Resources/info.plist b/src/Resources/info.plist index 9a48ef9e2..2f1e2556c 100644 --- a/src/Resources/info.plist +++ b/src/Resources/info.plist @@ -16,6 +16,8 @@ Seg3D.icns CFBundleGetInfoString Seg3D 2.0.0 - MIT License + NSHighResolutionCapable + CFBundleDocumentTypes From 914b6d4f87502d5001493ca4031999a630cec00a Mon Sep 17 00:00:00 2001 From: Ally Warner Date: Tue, 11 Aug 2020 12:17:56 -0600 Subject: [PATCH 3/6] Changed size of toolbar width Not sure if this will make a change. --- src/Interface/Application/ViewerWidget.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interface/Application/ViewerWidget.cc b/src/Interface/Application/ViewerWidget.cc index a928bf1c2..dbb1c20b7 100644 --- a/src/Interface/Application/ViewerWidget.cc +++ b/src/Interface/Application/ViewerWidget.cc @@ -335,7 +335,7 @@ void ViewerWidget::resizeEvent( QResizeEvent * event ) // 300px if( !this->private_->initialized_size_ ) { - this->private_->minimum_toolbar_width_ = 300; + this->private_->minimum_toolbar_width_ = 400; } else From 2440bb895349d72b91dd79d5518832391bb513a8 Mon Sep 17 00:00:00 2001 From: allywarner Date: Tue, 11 Aug 2020 12:23:26 -0600 Subject: [PATCH 4/6] Update info.plist add NS principal class --- src/Resources/info.plist | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Resources/info.plist b/src/Resources/info.plist index 2f1e2556c..bafeb0dd8 100644 --- a/src/Resources/info.plist +++ b/src/Resources/info.plist @@ -16,8 +16,10 @@ Seg3D.icns CFBundleGetInfoString Seg3D 2.0.0 - MIT License + NSPrincipalClass + NSApplication NSHighResolutionCapable - + True CFBundleDocumentTypes From 3dcc2a76cc4e3f069af81394a7560de0c9b9a5e1 Mon Sep 17 00:00:00 2001 From: Ally Warner Date: Tue, 11 Aug 2020 12:51:48 -0600 Subject: [PATCH 5/6] Update ViewerWidget.cc No change --- src/Interface/Application/ViewerWidget.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interface/Application/ViewerWidget.cc b/src/Interface/Application/ViewerWidget.cc index dbb1c20b7..a928bf1c2 100644 --- a/src/Interface/Application/ViewerWidget.cc +++ b/src/Interface/Application/ViewerWidget.cc @@ -335,7 +335,7 @@ void ViewerWidget::resizeEvent( QResizeEvent * event ) // 300px if( !this->private_->initialized_size_ ) { - this->private_->minimum_toolbar_width_ = 400; + this->private_->minimum_toolbar_width_ = 300; } else From 69ea8ce8f9c6d666c5d946907e6050ac476dffae Mon Sep 17 00:00:00 2001 From: Ally Warner Date: Thu, 3 Sep 2020 13:31:47 -0600 Subject: [PATCH 6/6] Fix 1/4 viewer and start QOpenGL update --- src/Core/Renderer/RendererBase.cc | 11 ++--- src/QtUtils/Utils/QtRenderResources.cc | 32 ++++++------- src/QtUtils/Utils/QtRenderResources.h | 6 +-- src/QtUtils/Utils/QtRenderWidget.cc | 10 ++--- src/QtUtils/Utils/QtRenderWidget.h | 45 ++++++++++--------- src/QtUtils/Utils/QtTransferFunctionWidget.cc | 6 +-- src/QtUtils/Utils/QtTransferFunctionWidget.h | 26 +++++------ 7 files changed, 69 insertions(+), 67 deletions(-) diff --git a/src/Core/Renderer/RendererBase.cc b/src/Core/Renderer/RendererBase.cc index 018811ecd..96b4c5b8f 100644 --- a/src/Core/Renderer/RendererBase.cc +++ b/src/Core/Renderer/RendererBase.cc @@ -98,7 +98,7 @@ void RendererBasePrivate::redraw_scene( PickPointHandle pick_point ) this->textures_[ this->active_scene_texture_ ], false ); // swap render textures - this->active_scene_texture_ = ( ~this->active_scene_texture_ ) & 1; + this->active_scene_texture_ = this->active_scene_texture_ ^ 1; } } } @@ -120,7 +120,7 @@ void RendererBasePrivate::redraw_overlay() this->textures_[ this->active_overlay_texture_ ], false ); // swap render textures - this->active_overlay_texture_ = ( ~( this->active_overlay_texture_ - 2 ) ) & 1 + 2; + this->active_overlay_texture_ = this->active_overlay_texture_^ 1; } } @@ -144,7 +144,7 @@ void RendererBasePrivate::redraw_all() this->textures_[ this->active_scene_texture_ ], render_overlay_success ); // swap render textures - this->active_scene_texture_ = ( ~this->active_scene_texture_ ) & 1; + this->active_scene_texture_ = this->active_scene_texture_ ^ 1; } if ( render_overlay_success ) @@ -154,7 +154,7 @@ void RendererBasePrivate::redraw_all() this->textures_[ this->active_overlay_texture_ ], false ); // swap render textures - this->active_overlay_texture_ = ( ~( this->active_overlay_texture_ - 2 ) ) & 1 + 2; + this->active_overlay_texture_ = this->active_overlay_texture_^ 1; } } @@ -417,7 +417,7 @@ void RendererBase::redraw_all() this->private_->redraw_all(); } -void RendererBase::resize( int width, int height ) +void RendererBase::resize(int width, int height) { if ( !this->is_renderer_thread() ) { @@ -447,6 +447,7 @@ void RendererBase::resize( int width, int height ) this->private_->scene_depth_buffer_->set_storage( width, height, GL_DEPTH_COMPONENT24 ); this->private_->overlay_depth_buffer_->set_storage( width, height, GL_DEPTH_COMPONENT24 ); } + std::cout << width << ", " << height << "\n"; this->width_ = width; this->height_ = height; diff --git a/src/QtUtils/Utils/QtRenderResources.cc b/src/QtUtils/Utils/QtRenderResources.cc index f7177fdfd..9a4a2b072 100644 --- a/src/QtUtils/Utils/QtRenderResources.cc +++ b/src/QtUtils/Utils/QtRenderResources.cc @@ -47,13 +47,13 @@ typedef boost::shared_ptr< QtRenderContext > QtRenderContextHandle; // Shared pointer to one of Qt's internal resources // NOTE: As GLContext objects are not managed by Qt we // need to do this ourselves using a smart pointer -typedef boost::shared_ptr< QGLContext > QGLContextHandle; +typedef boost::shared_ptr< QOpenGLContext > QOpenGLContextHandle; class QtRenderContext : public Core::RenderContext { // -- constructor/ destructor -- public: - QtRenderContext( QGLContextHandle context ); + QtRenderContext( QOpenGLContextHandle context ); virtual ~QtRenderContext(); // -- context functions -- @@ -74,21 +74,21 @@ class QtRenderContext : public Core::RenderContext virtual void swap_buffers() const; private: - QGLContextHandle context_; + QOpenGLContextHandle context_; }; class QtRenderResourcesContextPrivate { public: // The Qt render context format options - QGLFormat format_; + QSurfaceFormat format_; // The handle to the first qt widget that defines all the sharing // between contexts - QGLWidget* shared_widget_; + QOpenGLWidget* shared_widget_; }; -QtRenderContext::QtRenderContext( QGLContextHandle context ) : +QtRenderContext::QtRenderContext( QOpenGLContextHandle context ) : context_( context ) { } @@ -124,8 +124,8 @@ void QtRenderContext::swap_buffers() const QtRenderResourcesContext::QtRenderResourcesContext() : private_( new QtRenderResourcesContextPrivate ) { - this->private_->format_ = QGLFormat::defaultFormat(); - this->private_->shared_widget_ = new QGLWidget( this->private_->format_ ); + this->private_->format_ = QSurfaceFormat::defaultFormat(); + this->private_->shared_widget_ = new QOpenGLWidget( this->private_->format_ ); } QtRenderResourcesContext::~QtRenderResourcesContext() @@ -136,7 +136,7 @@ QtRenderResourcesContext::~QtRenderResourcesContext() bool QtRenderResourcesContext::create_render_context( Core::RenderContextHandle& context ) { // Generate a new context - QGLContextHandle qt_context = QGLContextHandle( new QGLContext( this->private_->format_, + QOpenGLContextHandle qt_context = QOpenGLContextHandle( new QOpenGLContext( this->private_->format_, this->private_->shared_widget_->context()->device() ) ); qt_context->create( this->private_->shared_widget_->context() ); @@ -146,16 +146,16 @@ bool QtRenderResourcesContext::create_render_context( Core::RenderContextHandle& return context->is_valid(); } -QtRenderWidget* QtRenderResourcesContext::create_qt_render_widget( QWidget* parent, +QtRenderWidget* QtRenderResourcesContext::create_qt_render_widget( QWidget* parent, Core::AbstractViewerHandle viewer ) { CORE_LOG_DEBUG( "Create an OpenGL widget" ); - return new QtRenderWidget( this->private_->format_, parent, + return new QtRenderWidget( this->private_->format_, parent, this->private_->shared_widget_, viewer ); } -QtTransferFunctionWidget* QtRenderResourcesContext::create_qt_transfer_function_widget( +QtTransferFunctionWidget* QtRenderResourcesContext::create_qt_transfer_function_widget( QWidget* parent, Core::TransferFunctionHandle tf ) { return new QtTransferFunctionWidget( this->private_->format_, parent, @@ -178,15 +178,15 @@ class SharedPtrNopDeleter Core::RenderContextHandle QtRenderResourcesContext::get_current_context() { - const QGLContext* current_context = QGLContext::currentContext(); + const QOpenGLContext* current_context = QOpenGLContext::currentContext(); if ( current_context != 0 ) { // NOTE: We don't want to delete the context after the handle goes out of scope, // so we pass a NOP deleter to shared_ptr - return Core::RenderContextHandle( new QtRenderContext( QGLContextHandle( - const_cast< QGLContext* >( current_context ), SharedPtrNopDeleter() ) ) ); + return Core::RenderContextHandle( new QtRenderContext( QOpenGLContextHandle( + const_cast< QOpenGLContext* >( current_context ), SharedPtrNopDeleter() ) ) ); } - + return Core::RenderContextHandle(); } diff --git a/src/QtUtils/Utils/QtRenderResources.h b/src/QtUtils/Utils/QtRenderResources.h index e2e6b1336..6f4b573a7 100644 --- a/src/QtUtils/Utils/QtRenderResources.h +++ b/src/QtUtils/Utils/QtRenderResources.h @@ -31,7 +31,7 @@ #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once -#endif +#endif // Glew include #include @@ -60,9 +60,9 @@ namespace QtUtils // Forward declarations class QtRenderResourcesContext; class QtRenderResourcesContextPrivate; -typedef boost::shared_ptr< QtRenderResourcesContext > +typedef boost::shared_ptr< QtRenderResourcesContext > QtRenderResourcesContextHandle; -typedef boost::shared_ptr< QtRenderResourcesContextPrivate > +typedef boost::shared_ptr< QtRenderResourcesContextPrivate > QtRenderResourcesContextPrivateHandle; // Class definition diff --git a/src/QtUtils/Utils/QtRenderWidget.cc b/src/QtUtils/Utils/QtRenderWidget.cc index 3b6376658..102849956 100644 --- a/src/QtUtils/Utils/QtRenderWidget.cc +++ b/src/QtUtils/Utils/QtRenderWidget.cc @@ -85,9 +85,9 @@ void QtRenderWidgetPrivate::exit_size_move() // Class QtRenderWidget ////////////////////////////////////////////////////////////////////////// -QtRenderWidget::QtRenderWidget( const QGLFormat& format, QWidget* parent, - QGLWidget* share, Core::AbstractViewerHandle viewer ) : - QGLWidget( format, parent, share ), +QtRenderWidget::QtRenderWidget( const QSurfaceFormat& format, QWidget* parent, + QOpenGLWidget* share, Core::AbstractViewerHandle viewer ) : + QOpenGLWidget( parent, share ), private_( new QtRenderWidgetPrivate ) { this->private_->viewer_ = viewer; @@ -165,8 +165,8 @@ void QtRenderWidget::paintGL() // draw a window size quad and map the render texture onto it QSize view_size = QWidget::size(); - int width = view_size.width(); - int height = view_size.height(); + int width = 2 * view_size.width(); + int height = 2 * view_size.height(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); diff --git a/src/QtUtils/Utils/QtRenderWidget.h b/src/QtUtils/Utils/QtRenderWidget.h index 282e76121..f8d5f396d 100644 --- a/src/QtUtils/Utils/QtRenderWidget.h +++ b/src/QtUtils/Utils/QtRenderWidget.h @@ -1,22 +1,22 @@ /* For more information, please see: http://software.sci.utah.edu - + The MIT License - + Copyright (c) 2016 Scientific Computing and Imaging Institute, University of Utah. - - + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -31,7 +31,7 @@ #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once -#endif +#endif #ifndef Q_MOC_RUN @@ -41,12 +41,13 @@ // Qt includes #undef __GLEW_H__ #include +#include #define __GLEW_H__ // Core includes #include -#include +#include #include #endif @@ -58,15 +59,15 @@ class QtRenderWidget; class QtRenderWidgetPrivate; typedef boost::shared_ptr QtRenderWidgetPrivateHandle; -class QtRenderWidget : public QGLWidget, private Core::ConnectionHandler +class QtRenderWidget : public QOpenGLWidget, private Core::ConnectionHandler { Q_OBJECT // -- constructor/ destructor -- public: - QtRenderWidget( const QGLFormat& format, QWidget* parent, QGLWidget* share, + QtRenderWidget( const QSurfaceFormat& format, QWidget* parent, QOpenGLWidget* share, Core::AbstractViewerHandle viewer ); - + virtual ~QtRenderWidget(); void saveSceneOnly(const std::string& name); @@ -78,12 +79,12 @@ Q_OBJECT /// INITIALIZEGL: /// This function is called by Qt when the widget is initialized virtual void initializeGL(); - + /// PAINTGL: - /// This function is called whenever Qt has to repaint the contents of + /// This function is called whenever Qt has to repaint the contents of /// the widget displaying the Qt scene virtual void paintGL(); - + /// RESIZEGL: /// This function gets called whenever the Qt widget is resized virtual void resizeGL( int width, int height ); @@ -95,22 +96,22 @@ Q_OBJECT /// MOUSEMOVEEVENT: /// This function is called by Qt to deliver mouse movement event - /// to the GUI. + /// to the GUI. virtual void mouseMoveEvent( QMouseEvent * event ); - + /// MOUSEDOUBLECLICKEVENT: /// This function is called by Qt to deliver a single mouse click event /// to the GUI. virtual void mousePressEvent( QMouseEvent * event ); - + /// MOUSERELEASEEVENT: /// This function is called by Qt to deliver a mouse button release event - /// to the GUI. + /// to the GUI. virtual void mouseReleaseEvent( QMouseEvent * event ); - + /// WHEELEVENT: /// This function is called by Qt to deliver mouse wheel event - /// to the GUI. + /// to the GUI. virtual void wheelEvent( QWheelEvent* event ); /// ENTEREVENT: @@ -120,7 +121,7 @@ Q_OBJECT /// LEAVEEVENT: /// This function is called by Qt when the mouse finishes to hover over the widget virtual void leaveEvent( QEvent* event ); - + /// KEYPRESSEVENT: /// This function is called by Qt when a key is pressed virtual void keyPressEvent( QKeyEvent* event ); @@ -136,7 +137,7 @@ Q_OBJECT // -- internals of the QtRenderWidget -- private: QtRenderWidgetPrivateHandle private_; - + // -- signals / slots -- public: /// ACTIVATE_SIGNAL: diff --git a/src/QtUtils/Utils/QtTransferFunctionWidget.cc b/src/QtUtils/Utils/QtTransferFunctionWidget.cc index c7fba3bf1..5b1543236 100644 --- a/src/QtUtils/Utils/QtTransferFunctionWidget.cc +++ b/src/QtUtils/Utils/QtTransferFunctionWidget.cc @@ -68,9 +68,9 @@ class QtTransferFunctionWidgetPrivate typedef QPointer< QtTransferFunctionWidget > QtTransferFunctionWidgetWeakHandle; -QtTransferFunctionWidget::QtTransferFunctionWidget( const QGLFormat& format, QWidget* parent, - QGLWidget* share, Core::TransferFunctionHandle tf ) : - QGLWidget( format, parent, share ), +QtTransferFunctionWidget::QtTransferFunctionWidget( const QSurfaceFormat& format, QWidget* parent, + QOpenGLWidget* share, Core::TransferFunctionHandle tf ) : + QOpenGLWidget( parent, share ), private_( new QtTransferFunctionWidgetPrivate ) { this->private_->transfer_function_ = tf; diff --git a/src/QtUtils/Utils/QtTransferFunctionWidget.h b/src/QtUtils/Utils/QtTransferFunctionWidget.h index 80299ef3f..18a422f85 100644 --- a/src/QtUtils/Utils/QtTransferFunctionWidget.h +++ b/src/QtUtils/Utils/QtTransferFunctionWidget.h @@ -1,22 +1,22 @@ /* For more information, please see: http://software.sci.utah.edu - + The MIT License - + Copyright (c) 2016 Scientific Computing and Imaging Institute, University of Utah. - - + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -31,7 +31,7 @@ #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once -#endif +#endif #ifndef Q_MOC_RUN @@ -56,15 +56,15 @@ class QtTransferFunctionWidget; class QtTransferFunctionWidgetPrivate; typedef boost::shared_ptr QtTransferFunctionWidgetPrivateHandle; -class QtTransferFunctionWidget : public QGLWidget, private Core::ConnectionHandler +class QtTransferFunctionWidget : public QOpenGLWidget, private Core::ConnectionHandler { Q_OBJECT // -- constructor/ destructor -- public: - QtTransferFunctionWidget( const QGLFormat& format, QWidget* parent, QGLWidget* share, + QtTransferFunctionWidget( const QSurfaceFormat& format, QWidget* parent, QOpenGLWidget* share, Core::TransferFunctionHandle tf ); - + virtual ~QtTransferFunctionWidget(); protected: @@ -72,12 +72,12 @@ class QtTransferFunctionWidget : public QGLWidget, private Core::ConnectionHandl /// INITIALIZEGL: /// This function is called by Qt when the widget is initialized virtual void initializeGL(); - + /// PAINTGL: - /// This function is called whenever Qt has to repaint the contents of + /// This function is called whenever Qt has to repaint the contents of /// the widget displaying the Qt scene virtual void paintGL(); - + /// RESIZEGL: /// This function gets called whenever the Qt widget is resized virtual void resizeGL( int width, int height );