opengl

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 647bbbaed1c74aa0dabc21ce32d71acb3c0c02e2
parent 942ea83fd65a3cd08556c50a374b0c1caaee8f8e
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Thu, 22 Jun 2023 18:11:14 +0900

handle keyboard input

Diffstat:
Dmain | 0
Mmain.c | 14+++++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/main b/main Binary files differ. diff --git a/main.c b/main.c @@ -10,6 +10,13 @@ framebuffer_size_callback(GLFWwindow *window, int width, int height) glViewport(0, 0, width, height); } +void +processInput(GLFWwindow *window) +{ + if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) + glfwSetWindowShouldClose(window, 1); +} + int main(void) { @@ -38,8 +45,13 @@ main(void) glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); while (!glfwWindowShouldClose(window)) { - glfwSwapBuffers(window); + processInput(window); + + glClearColor(0.2, 0.3, 0.3, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + glfwPollEvents(); + glfwSwapBuffers(window); } glfwTerminate();