From d67f8f91c02b7a1da1812d906acd5c70ac864cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Ulman?= <ulman@mpi-cbg.de> Date: Wed, 12 Oct 2016 20:34:07 +0200 Subject: [PATCH] Completed help mesages, adjusted some keys. Cosmetic overall. --- src/graphics.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/graphics.cpp b/src/graphics.cpp index e5dbc8d..0a88f71 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -51,6 +51,7 @@ bool showFrame=false; bool showBox=true; bool showWholeMesh=true; +bool showWholeMeshFilled=false; bool showWholeMeshEdges=false; bool showVertexSurface=false; bool showQuadricSurface=false; @@ -456,6 +457,7 @@ void printKeysHelp(void) std::cout << "'h': displays this help\n"; std::cout << "'d': displays enabled features,displays status\n"; std::cout << "'m': toggle display of the mesh\n"; + std::cout << "'M': toggle display of the mesh as wireframe or filled\n"; std::cout << "'e': toggle display of the mesh wireframe (triangle edges)'\n"; std::cout << "'v': toggle display of the vertex supporting region\n"; std::cout << "'V': chooses another vertex\n"; @@ -464,6 +466,7 @@ void printKeysHelp(void) std::cout << "'a': toggle display of the R,G,B <-> x,y,z axes \n"; std::cout << "'f': toggle display of the frame/plane az z=0\n"; std::cout << "'b': toggle display of the bounding box\n"; + std::cout << "'c','C': turns off,on z-buffer (off = render in the order of drawing)\n"; std::cout << "'x','X': controls for some testing\n"; std::cout << "'i': not used\n"; } @@ -554,6 +557,14 @@ void keyboard(unsigned char key, int mx, int my) showWholeMesh^=true; glutPostRedisplay(); break; + case 'M': + showWholeMeshFilled^=true; + if (showWholeMeshFilled) + glPolygonMode(GL_FRONT,GL_FILL); + else + glPolygonMode(GL_FRONT,GL_LINE); + glutPostRedisplay(); + break; case 'e': showWholeMeshEdges^=true; glutPostRedisplay(); @@ -574,6 +585,16 @@ void keyboard(unsigned char key, int mx, int my) showTEST^=true; glutPostRedisplay(); break; + case 'c': + glDisable(GL_DEPTH_TEST); + std::cout << "Z-buffer is OFF\n"; + glutPostRedisplay(); + break; + case 'C': + glEnable(GL_DEPTH_TEST); + std::cout << "Z-buffer is ON\n"; + glutPostRedisplay(); + break; //annotation controls case 'a': @@ -591,11 +612,9 @@ void keyboard(unsigned char key, int mx, int my) //some testing controls case 'x': - glPolygonMode(GL_FRONT,GL_LINE); glutPostRedisplay(); break; case 'X': - glPolygonMode(GL_FRONT,GL_FILL); glutPostRedisplay(); /* GLfloat ranges[10]; @@ -603,14 +622,6 @@ void keyboard(unsigned char key, int mx, int my) std::cout << "near=" << ranges[0] << ", far=" << ranges[1] << "\n"; */ break; - case 'c': - glDisable(GL_DEPTH_TEST); - glutPostRedisplay(); - break; - case 'C': - glEnable(GL_DEPTH_TEST); - glutPostRedisplay(); - break; case 'i': //inspect a cell GetSceneViewSize(windowSizeX,windowSizeY, xVisF,xVisT,yVisF,yVisT); @@ -757,8 +768,11 @@ void initializeGL(void) //default displaying mode for triangles //frontfaces are just lines, backfaces are opaque - glPolygonMode(GL_FRONT,GL_LINE); glPolygonMode(GL_BACK, GL_FILL); + if (showWholeMeshFilled) + glPolygonMode(GL_FRONT,GL_FILL); + else + glPolygonMode(GL_FRONT,GL_LINE); //but, well, do not draw backfaces at all glEnable(GL_CULL_FACE); -- GitLab