From 301d3e8f1fde9e24df41ae80fceb0ff467a14798 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 19 Nov 2010 08:10:17 +0000 Subject: [PATCH] *** empty log message *** --- src/OCCViewer/OCCViewer_ViewFrame.cxx | 8 ++++++++ src/OCCViewer/OCCViewer_ViewFrame.h | 2 +- src/OCCViewer/OCCViewer_ViewWindow.cxx | 11 ++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewFrame.cxx b/src/OCCViewer/OCCViewer_ViewFrame.cxx index 2bcd60f21..5baf2963e 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.cxx +++ b/src/OCCViewer/OCCViewer_ViewFrame.cxx @@ -216,3 +216,11 @@ void OCCViewer_ViewFrame::onContextMenuRequested(QContextMenuEvent*) myPopupRequestedView = dynamic_cast(sender()); } +void OCCViewer_ViewFrame::onDumpView() +{ + if (myPopupRequestedView) { + myPopupRequestedView->onDumpView(); + } else { + getView(MAIN_VIEW)->onDumpView(); + } +} diff --git a/src/OCCViewer/OCCViewer_ViewFrame.h b/src/OCCViewer/OCCViewer_ViewFrame.h index 7607577dd..19212da77 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.h +++ b/src/OCCViewer/OCCViewer_ViewFrame.h @@ -104,7 +104,7 @@ public slots: void onMaximizedView( OCCViewer_ViewWindow*, bool ); - virtual void onDumpView() { getView(MAIN_VIEW)->onDumpView(); } + virtual void onDumpView(); private slots: void onContextMenuRequested(QContextMenuEvent*); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 121614a05..350790032 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -1547,14 +1547,18 @@ QImage OCCViewer_ViewWindow::dumpView() Handle(V3d_View) view = myViewPort->getView(); if ( view.IsNull() ) return QImage(); + int aWidth = myViewPort->width(); int aHeight = myViewPort->height(); QApplication::syncX(); - view->Update(); + view->Redraw(); // In order to reactivate GL context + //view->Update(); OpenGLUtils_FrameBuffer aFrameBuffer; if( aFrameBuffer.init( aWidth, aHeight ) ) { + QImage anImage( aWidth, aHeight, QImage::Format_RGB32 ); + glPushAttrib( GL_VIEWPORT_BIT ); glViewport( 0, 0, aWidth, aHeight ); aFrameBuffer.bind(); @@ -1565,8 +1569,6 @@ QImage OCCViewer_ViewWindow::dumpView() aFrameBuffer.unbind(); glPopAttrib(); - QImage anImage( aWidth, aHeight, QImage::Format_RGB32 ); - aFrameBuffer.bind(); glReadPixels( 0, 0, aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE, anImage.bits() ); aFrameBuffer.unbind(); @@ -1575,9 +1577,8 @@ QImage OCCViewer_ViewWindow::dumpView() anImage = anImage.mirrored(); return anImage; } - // if frame buffers are unsupported, use old functionality - view->Redraw(); + //view->Redraw(); unsigned char* data = new unsigned char[ aWidth*aHeight*4 ]; -- 2.39.2