summary refs log tree commit diff
diff options
context:
space:
mode:
authormakefunstuff <[email protected]>2024-08-07 21:08:13 +0200
committermakefunstuff <[email protected]>2024-08-07 21:08:13 +0200
commit7618c9ae9b442b430ddb630806f83515bbb727de (patch)
tree67fbbdbef26650e3a5a272917a6076235af91498
parent6b94ae24f09a48f7d20942d48741251ada2bda43 (diff)
downloadogl-7618c9ae9b442b430ddb630806f83515bbb727de.tar.gz
handle primary monitor
Diffstat (limited to '')
-rw-r--r--src/main.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index aa042b0..c99bf1c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3,8 +3,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#define GL_SILENCE_DEPRECATION 1
-
 int main() {
   // Initialize GLFW
   if (!glfwInit()) {
@@ -17,7 +15,10 @@ int main() {
   glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
 
   // Create a windowed mode window and its OpenGL context
-  GLFWwindow *window = glfwCreateWindow(320, 240, "Blue screen", NULL, NULL);
+  GLFWmonitor *glfwMonitor = glfwGetPrimaryMonitor();
+  const GLFWvidmode *mode = glfwGetVideoMode(glfwMonitor);
+  GLFWwindow *window = glfwCreateWindow(mode->width, mode->height,
+                                        "Blue screen", glfwMonitor, NULL);
   if (!window) {
     glfwTerminate();
     return -1;
@@ -32,11 +33,7 @@ int main() {
     return -1;
   }
 
-  float vertices[] = {
-      -0.5f, -0.5f, 0.0f,
-       0.5f, -0.5f, 0.0f,
-       0.0f,  0.5f, 0.0f
-  };
+  float vertices[] = {-0.5f, -0.5f, 0.0f, 0.5f, -0.5f, 0.0f, 0.0f, 0.5f, 0.0f};
 
   unsigned int VBO;
   glGenBuffers(1, &VBO);