mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Make sure grabbed buffer is GL_FRONT
p4#: 21534
This commit is contained in:
@@ -1164,9 +1164,9 @@ void RiaApplication::saveSnapshotPromtpForFilename()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::saveSnapshotAs(const QString& fileName)
|
void RiaApplication::saveSnapshotAs(const QString& fileName)
|
||||||
{
|
{
|
||||||
if (m_activeReservoirView && m_activeReservoirView->viewer())
|
QImage image = grabFrameBufferImage();
|
||||||
|
if (!image.isNull())
|
||||||
{
|
{
|
||||||
QImage image = m_activeReservoirView->viewer()->grabFrameBuffer();
|
|
||||||
if (image.save(fileName))
|
if (image.save(fileName))
|
||||||
{
|
{
|
||||||
qDebug() << "Saved snapshot image to " << fileName;
|
qDebug() << "Saved snapshot image to " << fileName;
|
||||||
@@ -1183,12 +1183,11 @@ void RiaApplication::saveSnapshotAs(const QString& fileName)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::copySnapshotToClipboard()
|
void RiaApplication::copySnapshotToClipboard()
|
||||||
{
|
{
|
||||||
if (m_activeReservoirView && m_activeReservoirView->viewer())
|
QClipboard* clipboard = QApplication::clipboard();
|
||||||
|
if (clipboard)
|
||||||
{
|
{
|
||||||
QImage image = m_activeReservoirView->viewer()->grabFrameBuffer();
|
QImage image = grabFrameBufferImage();
|
||||||
|
if (!image.isNull())
|
||||||
QClipboard* clipboard = QApplication::clipboard();
|
|
||||||
if (clipboard)
|
|
||||||
{
|
{
|
||||||
clipboard->setImage(image);
|
clipboard->setImage(image);
|
||||||
}
|
}
|
||||||
@@ -1479,3 +1478,25 @@ cvf::Font* RiaApplication::standardFont()
|
|||||||
|
|
||||||
return m_standardFont.p();
|
return m_standardFont.p();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QImage RiaApplication::grabFrameBufferImage()
|
||||||
|
{
|
||||||
|
QImage image;
|
||||||
|
if (m_activeReservoirView && m_activeReservoirView->viewer())
|
||||||
|
{
|
||||||
|
m_activeReservoirView->viewer()->repaint();
|
||||||
|
|
||||||
|
GLint currentReadBuffer;
|
||||||
|
glGetIntegerv(GL_READ_BUFFER, ¤tReadBuffer);
|
||||||
|
|
||||||
|
glReadBuffer(GL_FRONT);
|
||||||
|
image = m_activeReservoirView->viewer()->grabFrameBuffer();
|
||||||
|
|
||||||
|
glReadBuffer(currentReadBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ private:
|
|||||||
void onProjectOpenedOrClosed();
|
void onProjectOpenedOrClosed();
|
||||||
void setWindowCaptionFromAppState();
|
void setWindowCaptionFromAppState();
|
||||||
|
|
||||||
|
QImage grabFrameBufferImage();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||||
|
|||||||
Reference in New Issue
Block a user