mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use modern OpenGL Qt widget
Use cvfqt::OpenGLWidget and make required changes - move code from paintEvent to paintGL to make grabFrambuffer work - remove obsolete sharedWidget - implement onWidgetOpenGLReady and initialize rendering in this function as OpenGL capabilities is required - simplify snapshotImage to use grabFramebuffer Fix missing include
This commit is contained in:
@@ -358,14 +358,11 @@ cvf::Color3f Rim3dView::backgroundColor() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* Rim3dView::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
QGLFormat glFormat;
|
||||
glFormat.setDirectRendering( RiaGuiApplication::instance()->useShaders() );
|
||||
|
||||
// If parent widget is a live widget, the application will get OpenGL window issues if started on a non-primary
|
||||
// screen. Using nullptr as parent solves the issue.
|
||||
// https://github.com/OPM/ResInsight/issues/8192
|
||||
//
|
||||
m_viewer = new RiuViewer( glFormat, nullptr );
|
||||
m_viewer = new RiuViewer( nullptr );
|
||||
m_viewer->setOwnerReservoirView( this );
|
||||
|
||||
cvf::String xLabel;
|
||||
@@ -537,11 +534,6 @@ QImage Rim3dView::snapshotWindowContent()
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
// Force update of scheduled display models before snapshotting
|
||||
RiaViewRedrawScheduler::instance()->updateAndRedrawScheduledViews();
|
||||
|
||||
m_viewer->repaint();
|
||||
|
||||
return m_viewer->snapshotImage();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,8 @@
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaRegressionTestRunner.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
#include "RivGridBoxGenerator.h"
|
||||
@@ -60,20 +58,15 @@
|
||||
|
||||
#include "cvfCamera.h"
|
||||
#include "cvfFont.h"
|
||||
#include "cvfOpenGLResourceManager.h"
|
||||
#include "cvfOverlayAxisCross.h"
|
||||
#include "cvfOverlayItem.h"
|
||||
#include "cvfPartRenderHintCollection.h"
|
||||
#include "cvfRenderQueueSorter.h"
|
||||
#include "cvfRenderSequence.h"
|
||||
#include "cvfRendering.h"
|
||||
#include "cvfScene.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
using cvf::ManipulatorTrackball;
|
||||
|
||||
const double RI_MIN_NEARPLANE_DISTANCE = 0.1;
|
||||
@@ -92,8 +85,8 @@ std::unique_ptr<QCursor> RiuViewer::s_hoverCursor;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuViewer::RiuViewer( const QGLFormat& format, QWidget* parent )
|
||||
: caf::Viewer( format, parent )
|
||||
RiuViewer::RiuViewer( QWidget* parent )
|
||||
: caf::Viewer( parent )
|
||||
, m_isNavigationRotationEnabled( true )
|
||||
, m_zScale( 1.0 )
|
||||
{
|
||||
|
||||
@@ -23,15 +23,9 @@
|
||||
#include "RiuInterfaceToViewWindow.h"
|
||||
#include "RiuViewerToViewInterface.h"
|
||||
|
||||
#include "cafFontTools.h"
|
||||
#include "cafMouseState.h"
|
||||
#include "cafPdmInterfacePointer.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafViewer.h"
|
||||
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RicCommandFeature;
|
||||
@@ -73,7 +67,7 @@ class RiuViewer : public caf::Viewer, public RiuInterfaceToViewWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RiuViewer( const QGLFormat& format, QWidget* parent );
|
||||
RiuViewer( QWidget* parent );
|
||||
~RiuViewer() override;
|
||||
|
||||
RiuViewer( const RiuViewer& ) = delete;
|
||||
|
||||
Reference in New Issue
Block a user