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:
parent
991cd7198e
commit
8ef10316d8
@ -1164,9 +1164,9 @@ void RiaApplication::saveSnapshotPromtpForFilename()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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))
|
||||
{
|
||||
qDebug() << "Saved snapshot image to " << fileName;
|
||||
@ -1183,12 +1183,11 @@ void RiaApplication::saveSnapshotAs(const QString& fileName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::copySnapshotToClipboard()
|
||||
{
|
||||
if (m_activeReservoirView && m_activeReservoirView->viewer())
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
if (clipboard)
|
||||
{
|
||||
QImage image = m_activeReservoirView->viewer()->grabFrameBuffer();
|
||||
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
if (clipboard)
|
||||
QImage image = grabFrameBufferImage();
|
||||
if (!image.isNull())
|
||||
{
|
||||
clipboard->setImage(image);
|
||||
}
|
||||
@ -1479,3 +1478,25 @@ cvf::Font* RiaApplication::standardFont()
|
||||
|
||||
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 setWindowCaptionFromAppState();
|
||||
|
||||
|
||||
QImage grabFrameBufferImage();
|
||||
|
||||
private slots:
|
||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
Loading…
Reference in New Issue
Block a user