diff options
Diffstat (limited to 'src/display.c')
-rw-r--r-- | src/display.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/display.c b/src/display.c index a09cc46..ba9bc48 100644 --- a/src/display.c +++ b/src/display.c @@ -12,7 +12,7 @@ static void error_callback(int error, const char* description) static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { - if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) + if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } @@ -24,6 +24,7 @@ GLubyte pixels[BUF_CAP] = {0}; void pixel(int x, int y, char *buf) { + // for rotating the screen int p = (y*WIDTH + x)*3; int b = ((HEIGHT-1-y)*WIDTH+x)*3; pixels[p+0] = buf[b+0]; @@ -53,20 +54,15 @@ int display(void) glfwMakeContextCurrent(window); glfwSwapInterval(1); - - unsigned char *copy_cam_data; while (!glfwWindowShouldClose(window)) { - // memcpy(copy_cam_data, cam_data, BUF_CAP); - copy_cam_data = cam_data; - - WIDTH = MAX(copy_cam_data[0], 1); - HEIGHT = MAX(copy_cam_data[1], 1); + WIDTH = MAX(cam_data[0], 1); + HEIGHT = MAX(cam_data[1], 1); glfwSetWindowSize(window, WIDTH, HEIGHT); for(int i = 0; i < HEIGHT; i++) for(int j = 0; j < WIDTH; j++) - pixel(j, i, &(copy_cam_data[2])); + pixel(j, i, &(cam_data[2])); glClear(GL_COLOR_BUFFER_BIT); glDrawPixels(WIDTH, HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, pixels); |