Commit 0b0e357c authored by Frédéric Larue's avatar Frédéric Larue

Bug fixed in the GLViewer::renderCoords function.

parent 203f9424
......@@ -1373,14 +1373,10 @@ void GLViewer::renderCoords( double x, double y, double z, double *screenX, doub
{
// Identify x and y locations to render text within widget
QMatrix4x4 model, proj;
GLint viewport[4];
glGetFloatv( GL_MODELVIEW_MATRIX, model.data() );
glGetFloatv( GL_PROJECTION_MATRIX, proj.data() );
glGetIntegerv( GL_VIEWPORT, viewport );
QMatrix4x4 mvp = viewProjectionMatrix();
*screenX = *screenY = 0.0;
QVector4D out = proj.map( model.map( QVector4D(x,y,z,1.0f) ) );
QVector4D out = mvp.map( QVector4D(x,y,z,1.0f) );
if( out.w() != 0.0f )
{
......@@ -1388,8 +1384,8 @@ void GLViewer::renderCoords( double x, double y, double z, double *screenX, doub
out.setX( out.x() * wInv );
out.setY( out.y() * wInv );
*screenX = viewport[0] + (1 + out.x()) * 0.5 * viewport[2];
*screenY = viewport[1] + (1 + out.y()) * 0.5 * viewport[3];
*screenX = (1 + out.x()) * 0.5 * width();
*screenY = (1 + out.y()) * 0.5 * height();
}
*screenY = this->height() - *screenY; // y is inverted
......@@ -1724,7 +1720,7 @@ void GLViewer::mouseMoveEvent( QMouseEvent *evt )
navigationControl()->mouseMoveEvent( dx, dy, evt );
}
else if( !isSelectionEnabled() )
else if( evt->modifiers() & Qt::ShiftModifier )//if( !isSelectionEnabled() )
findObjectUnderCursor( evt->pos() );
}
......
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