fixed resize

This commit is contained in:
k 2025-05-03 19:54:30 -04:00
parent 152277cd77
commit 136e02a692

10
main.cc
View File

@ -42,13 +42,18 @@ GLuint linkProgram(std::vector<GLuint> shaders) {
return program; return program;
} }
void resizeCall(GLFWwindow *window, int width, int height) {
glViewport(0, 0, width, height);
}
int main() { int main() {
if (!glfwInit()) if (!glfwInit())
return -1; return -1;
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
GLFWwindow *w = glfwCreateWindow(800, 600, "game of life", NULL, NULL); GLFWwindow *w = glfwCreateWindow(800, 600, "game of life", NULL, NULL);
if (!w) if (!w)
@ -60,7 +65,8 @@ int main() {
return -3; return -3;
glfwShowWindow(w); glfwShowWindow(w);
glViewport(0, 0, 800, 637); glViewport(0, 0, 800, 600);
glfwSetFramebufferSizeCallback(w, resizeCall);
/*gen tex*/ /*gen tex*/
GLuint tex[2]; GLuint tex[2];