diff --git a/CMakeLists.txt b/CMakeLists.txt index adeb44f..2fab185 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ add_executable( fc2d src/error.cpp src/eye.cpp src/configfile.cpp + src/input.cpp packaging/fc2d.rc ) target_link_libraries( fc2d ${OpenCV_LIBS} ${OPENGL_LIBRARIES} ${WEBP_LIBRARIES} diff --git a/src/graphics.cpp b/src/graphics.cpp index 5085aa6..cff172d 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -23,6 +23,12 @@ #include #include #include +#include + +#ifndef NO_GRAPHICAL_DIALOG +#include +#endif + GLuint shader; //standard shader program used for all elements GLuint transUniform; //location of the "transMatrix" transformation matrix uniform in the shader @@ -98,6 +104,9 @@ void initGraphics () { glutInitWindowSize(512, 512); glutCreateWindow(PROJECT_NAME); + // input callback + glutKeyboardFunc(keyInput); + glewExperimental = GL_TRUE; glewInit(); @@ -237,3 +246,7 @@ void updateModel(struct FaceData faceData) { //tell FreeGLUT to schedule a screen update glutPostRedisplay(); } + +void showModelInfo() { + boxer::show(model->getInfoString().c_str(), "Model info", boxer::Style::Info); +} diff --git a/src/graphics.hpp b/src/graphics.hpp index 875a95b..2806965 100644 --- a/src/graphics.hpp +++ b/src/graphics.hpp @@ -10,6 +10,8 @@ #include #include +#include +#include extern GLuint transUniform; extern float windowAspectRatio; @@ -28,4 +30,6 @@ void printShaderCompileLog(GLuint shader); void updateModel(struct FaceData faceData); +void showModelInfo(); + #endif diff --git a/src/input.cpp b/src/input.cpp new file mode 100644 index 0000000..7faa7f4 --- /dev/null +++ b/src/input.cpp @@ -0,0 +1,12 @@ +#include +#include + +void keyInput(unsigned char key, int x, int y) { + switch(key) { + case 'i': // model info + showModelInfo(); + break; + default: + break; + } +} diff --git a/src/input.hpp b/src/input.hpp new file mode 100644 index 0000000..4d2d6aa --- /dev/null +++ b/src/input.hpp @@ -0,0 +1,6 @@ +#ifndef INPUT_HPP +#define INPUT_HPP + +void keyInput(unsigned char key, int x, int y); + +#endif