diff --git a/src/main.cpp b/src/main.cpp index 0a8910a..36ff647 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,11 +19,13 @@ static GLFWwindow* window; static float width, height; +static glm::mat4 projection_t; void framebuffer_size_callback(GLFWwindow* window, int w, int h) { width = w; height = h; glViewport(0, 0, width, height); + projection_t = glm::infinitePerspective(glm::radians(45.0f), (float)width / (float)height, 0.1f); } void process_input() { @@ -48,7 +50,7 @@ void* process_cin(void* args) { while (true) { std::getline(std::cin, line); Array words = split_str(line.c_str()); - assert(words.len == 4); + if (!words.len == 4) return NULL; printf("Received: %s, %s, %s, %s\n", words[0], words[1], words[2], words[3]); // echo for debugging float x = atof(words[1]); float y = atof(words[2]); @@ -194,7 +196,7 @@ int main() { glDisable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); - glm::mat4 projection_t = glm::infinitePerspective(glm::radians(45.0f), (float)width / (float)height, 0.1f); + projection_t = glm::infinitePerspective(glm::radians(45.0f), (float)width / (float)height, 0.1f); pthread_t thread_id; pthread_create(&thread_id, NULL, process_cin, NULL);