Commit 8bebbd2e authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Selection tool display improved.

parent 4924d2a5
...@@ -67,6 +67,7 @@ void SelectionTool::displaySelectionState() const ...@@ -67,6 +67,7 @@ void SelectionTool::displaySelectionState() const
{ {
// Backup the current OpenGL state. // Backup the current OpenGL state.
GLboolean depthTestEnabled = glIsEnabled( GL_DEPTH_TEST );
GLboolean multisampleEnabled = glIsEnabled( GL_MULTISAMPLE ); GLboolean multisampleEnabled = glIsEnabled( GL_MULTISAMPLE );
GLfloat currentColor[4]; GLfloat currentColor[4];
glGetFloatv( GL_CURRENT_COLOR, currentColor ); glGetFloatv( GL_CURRENT_COLOR, currentColor );
...@@ -88,13 +89,15 @@ void SelectionTool::displaySelectionState() const ...@@ -88,13 +89,15 @@ void SelectionTool::displaySelectionState() const
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
glDisable( GL_DEPTH_TEST );
//glDisable( GL_MULTISAMPLE );
// Display the "+" or "-" sign indicating what is the current selection update mode. // Display the "+" or "-" sign indicating what is the current selection update mode.
QPoint cursor = m_Viewer.mapFromGlobal( m_Viewer.cursor().pos() ); QPoint cursor = m_Viewer.mapFromGlobal( m_Viewer.cursor().pos() );
cursor.setY( m_Viewer.height() - 1 - cursor.y() ); cursor.setY( m_Viewer.height() - 1 - cursor.y() );
glDisable( GL_MULTISAMPLE );
glColor3ub( 0, 0, 0 ); glColor3ub( 0, 0, 0 );
if( m_Context.selectionMode != SelectionTool::SELECTION_MODE_SET ) if( m_Context.selectionMode != SelectionTool::SELECTION_MODE_SET )
...@@ -114,13 +117,26 @@ void SelectionTool::displaySelectionState() const ...@@ -114,13 +117,26 @@ void SelectionTool::displaySelectionState() const
// Display the label indicating which entity is currently selected. // Display the label indicating which entity is currently selected.
QString entityName;
switch( m_Context.entityToSelect ) switch( m_Context.entityToSelect )
{ {
case SELECTABLE_ENTITY_VERTEX: m_Viewer.renderText( cursor.x()+10, cursor.y()-15, 0.0, "Vertex" ); break; case SELECTABLE_ENTITY_VERTEX: entityName = "Vertex"; break;
case SELECTABLE_ENTITY_FACE : m_Viewer.renderText( cursor.x()+10, cursor.y()-15, 0.0, "Face" ); break; case SELECTABLE_ENTITY_FACE : entityName = "Face" ; break;
case SELECTABLE_ENTITY_TEXEL : m_Viewer.renderText( cursor.x()+10, cursor.y()-15, 0.0, "Texel" ); break; case SELECTABLE_ENTITY_TEXEL : entityName = "Texel" ; break;
} }
int entityNameX = cursor.x() + 10;
int entityNameY = m_Viewer.height() - 1 - cursor.y() + 15;
glColor4ub( 255, 255, 255, 192 );
m_Viewer.renderText( entityNameX, entityNameY-1, entityName );
m_Viewer.renderText( entityNameX, entityNameY+1, entityName );
m_Viewer.renderText( entityNameX-1, entityNameY, entityName );
m_Viewer.renderText( entityNameX+1, entityNameY, entityName );
glColor3ub( 0, 0, 0 );
m_Viewer.renderText( entityNameX, entityNameY, entityName );
// Restore OpenGL matrices. // Restore OpenGL matrices.
...@@ -132,6 +148,7 @@ void SelectionTool::displaySelectionState() const ...@@ -132,6 +148,7 @@ void SelectionTool::displaySelectionState() const
// Restore the backuped OpenGL state. // Restore the backuped OpenGL state.
depthTestEnabled? glEnable( GL_DEPTH_TEST ) : glDisable( GL_DEPTH_TEST );
multisampleEnabled? glEnable( GL_MULTISAMPLE ) : glDisable( GL_MULTISAMPLE ); multisampleEnabled? glEnable( GL_MULTISAMPLE ) : glDisable( GL_MULTISAMPLE );
glColor4fv( currentColor ); glColor4fv( currentColor );
glLineWidth( lineWidth ); glLineWidth( lineWidth );
......
Supports Markdown
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