Commit 1a8b406c authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Bug fix in the GLViewer::imageOfCurrentDisplay() function.

parent 908b9b39
......@@ -1568,24 +1568,31 @@ bool GLViewer::imageOfCurrentDisplay( const GenericUIData *m, QImage &renderResu
fb.Attach( GL_COLOR_ATTACHMENT0, GL_RGBA );
fb.Bind();
glClearColor( 1.0f, 0.0f, 0.0f, 1.0f );
glClear( GL_COLOR_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
glOrtho( dBox.Min().x(), dBox.Max().x(), dBox.Max().y(), dBox.Min().y(), -1.0f, 1.0f );
glMultMatrixf( m_ViewMatrixInverse.data() );
glMultMatrixf( modelMatrixInverse(d).data() );
QMatrix4x4 projBackup = m_ProjectionMatrix;
glGetFloatv( GL_PROJECTION_MATRIX, m_ProjectionMatrix.data() );
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
glLoadMatrixf( m_ViewMatrix.data() );
glMultMatrixf( modelMatrix(d).data() );
d->onDisplay( *m->GetDisplayOptions() );
glMatrixMode( GL_MODELVIEW );
glPopMatrix();
glMatrixMode( GL_PROJECTION );
glPopMatrix();
m_ProjectionMatrix = projBackup;
fb.Unbind();
......@@ -1602,7 +1609,7 @@ bool GLViewer::imageOfCurrentDisplay( const GenericUIData *m, QImage &renderResu
lineData[x] = fbData[n];
}
delete [] fbData;
delete[] fbData;
return true;
......
......@@ -253,7 +253,7 @@ public:
inline const QMatrix4x4& viewRotationMatrix() const { return m_View.viewRotationMatrix; }
inline const QMatrix4x4& viewRotationMatrixInverse() const { return m_ViewRotationMatrixInverse; }
QMatrix4x4 modelMatrix( const DisplayableInterface *d ) const;
QMatrix4x4 modelMatrixInverse( const DisplayableInterface *d ) const;
inline QMatrix4x4 modelMatrixInverse( const DisplayableInterface *d ) const { return modelMatrix(d).inverted(); }
inline const QMatrix4x4& viewProjectionMatrix() const { return m_ViewProjectionMatrix; }
inline const QMatrix4x4& viewProjectionMatrixInverse() const { return m_ViewProjectionMatrixInverse; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment