From bdf7144d863c1f4702a076ef8f686673f51b9290 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 6 Feb 2024 11:46:10 +0100 Subject: [PATCH] Test grabbuffer --- Fwk/AppFwk/cafViewer/cafViewer.cpp | 6 +++--- Fwk/AppFwk/cafViewer/cafViewer.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Fwk/AppFwk/cafViewer/cafViewer.cpp b/Fwk/AppFwk/cafViewer/cafViewer.cpp index a08012bad3..3d66c0a864 100644 --- a/Fwk/AppFwk/cafViewer/cafViewer.cpp +++ b/Fwk/AppFwk/cafViewer/cafViewer.cpp @@ -793,10 +793,8 @@ bool caf::Viewer::isPerfInfoHudEnabled() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void caf::Viewer::paintEvent( QPaintEvent* event ) +void caf::Viewer::paintGL() { - makeCurrent(); - cvf::ref myOglContext = cvfOpenGLContext(); CVF_CHECK_OGL( myOglContext.p() ); CVF_ASSERT( myOglContext->isContextValid() ); @@ -1205,6 +1203,8 @@ bool caf::Viewer::isShadersSupported() //-------------------------------------------------------------------------------------------------- QImage caf::Viewer::snapshotImage() { + return grabFramebuffer(); + // Qt5 : Call paintEvent() manually to make sure invisible widgets are rendered properly // If this call is skipped, we get an assert in cvf::FramebufferObject::bind() paintEvent( nullptr ); diff --git a/Fwk/AppFwk/cafViewer/cafViewer.h b/Fwk/AppFwk/cafViewer/cafViewer.h index c438caa105..10e91301de 100644 --- a/Fwk/AppFwk/cafViewer/cafViewer.h +++ b/Fwk/AppFwk/cafViewer/cafViewer.h @@ -204,7 +204,7 @@ public slots: // Standard overrides. Not for overriding void resizeGL( int width, int height ) override; - void paintEvent( QPaintEvent* event ) override; + void paintGL() override; // Support the navigation policy concept bool event( QEvent* e ) override;