From a5ceca86f6ab2908de09bb5bcdec4269e6458aee Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Mon, 1 Apr 2024 14:00:22 -0400 Subject: [PATCH] Add timing information --- main.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 3d36cf2..6c5421b 100644 --- a/main.cpp +++ b/main.cpp @@ -17,14 +17,16 @@ using namespace cv; using namespace std; +using namespace std::chrono; +using time_stamp = time_point; Mat image; GLuint imageTexture; GLint screenWidth = 0; GLint screenHeight = 0; - -void displayMe(void) -{ +time_stamp ts; + +void getScreenDimensions () { if (screenWidth == 0 && screenHeight == 0) { GLint dims[4] = {0}; glGetIntegerv(GL_VIEWPORT, dims); @@ -32,6 +34,11 @@ void displayMe(void) screenHeight = dims[3]; cout << screenWidth << "," << screenHeight << endl; } +} + +void displayMe(void) +{ + getScreenDimensions(); string image_path = samples::findFile("chart.png"); Mat image = imread(image_path, IMREAD_COLOR); @@ -47,7 +54,7 @@ void displayMe(void) glColor3f(1, 0, 0); glVertex3f(-1.0, -1.0, 0.5); glColor3f(0, 1, 0); glVertex3f(1.0, -1.0, 0); glColor3f(0, 0, 1); glVertex3f(1.0, 1.0, 0); - glVertex3f(-1.0, 1.0, 0); + glColor3f(0, 0, 0); glVertex3f(-1.0, 1.0, 0); glEnd(); // Flush drawing command buffer to make drawing happen as soon as possible. @@ -56,15 +63,12 @@ void displayMe(void) int main(int argc, char** argv) { - + ts = time_point_cast(system_clock::now()); glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE); glutCreateWindow("opengl_opencv_example"); glutFullScreen(); glutDisplayFunc(displayMe); glutMainLoop(); - - - return 0; } \ No newline at end of file