diff options
author | makefunstuff <[email protected]> | 2024-08-07 21:08:13 +0200 |
---|---|---|
committer | makefunstuff <[email protected]> | 2024-08-07 21:08:13 +0200 |
commit | 7618c9ae9b442b430ddb630806f83515bbb727de (patch) | |
tree | 67fbbdbef26650e3a5a272917a6076235af91498 | |
parent | 6b94ae24f09a48f7d20942d48741251ada2bda43 (diff) | |
download | ogl-7618c9ae9b442b430ddb630806f83515bbb727de.tar.gz |
handle primary monitor
-rw-r--r-- | src/main.c | 13 |
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); |