/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* glfw.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/05/11 01:58:00 by charles #+# #+# */ /* Updated: 2020/05/11 09:41:51 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include "scop.h" GLFWwindow *glfw_init(int width, int height) { GLFWwindow *window; if (!glfwInit()) return (NULL); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); window = glfwCreateWindow(width, height, "scop", NULL, NULL); if (window == NULL) { glfwTerminate(); return (NULL); } glfwMakeContextCurrent(window); if (glewInit() != GLEW_OK) { glfwDestroyWindow(window); glfwTerminate(); return (NULL); } glfwSwapInterval(1); glViewport(0, 0, width, height); return (window); }