aboutsummaryrefslogtreecommitdiff
path: root/src/glfw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glfw.c')
-rw-r--r--src/glfw.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/glfw.c b/src/glfw.c
index 8afdfe4..a492c08 100644
--- a/src/glfw.c
+++ b/src/glfw.c
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/05/11 01:58:00 by charles #+# #+# */
-/* Updated: 2020/05/11 02:16:58 by charles ### ########.fr */
+/* Updated: 2020/05/11 09:41:51 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,6 +18,9 @@ GLFWwindow *glfw_init(int width, int height)
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)
{
@@ -25,6 +28,13 @@ GLFWwindow *glfw_init(int width, int height)
return (NULL);
}
glfwMakeContextCurrent(window);
- glewInit();
+ if (glewInit() != GLEW_OK)
+ {
+ glfwDestroyWindow(window);
+ glfwTerminate();
+ return (NULL);
+ }
+ glfwSwapInterval(1);
+ glViewport(0, 0, width, height);
return (window);
}