Add timing information
This commit is contained in:
parent
0f42160ee9
commit
a5ceca86f6
20
main.cpp
20
main.cpp
|
@ -17,14 +17,16 @@
|
|||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
using time_stamp = time_point<system_clock, microseconds>;
|
||||
|
||||
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<microseconds>(system_clock::now());
|
||||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode(GLUT_SINGLE);
|
||||
glutCreateWindow("opengl_opencv_example");
|
||||
glutFullScreen();
|
||||
glutDisplayFunc(displayMe);
|
||||
glutMainLoop();
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue