I'm using GLFW to create a full screen GL application. I'm running it on my Ubuntu 20.04 laptop that has a typical 1920:1080 display, at least that's the screen resolution reported under Settings->Displays. When I run the following code:
int monitor_x = 0; int monitor_y = 0; int monitor_width = 0; int monitor_height = 0; GLFWmonitor *monitor = glfwGetPrimaryMonitor(); glfwGetMonitorWorkarea(monitor, &monitor_x, &monitor_y, &monitor_width, &monitor_height); printf("before monitor %d, %d, %d, %d\n", monitor_x, monitor_y, monitor_width, monitor_height); window = glfwCreateWindow(1920, 1080, "OpenGL", glfwGetPrimaryMonitor(), nullptr); // Fullscreen glfwGetMonitorWorkarea(monitor, &monitor_x, &monitor_y, &monitor_width, &monitor_height); printf("after monitor %d, %d, %d, %d\n", monitor_x, monitor_y, monitor_width, monitor_height);
When I run the code, I get the following output on stdout:
before monitor 72, 27, 1848, 1053 after monitor 72, 27, 1848, 1053
Also, it seems as if there's a horizontal band at the top and a vertical band at the right of the full screen that remains the background color, no matter what my application attempts to write to those areas.
So 72 + 1848 = 1920 and 27 + 1053 = 1080, but it seems that the system is reserving these horizontal and vertical bands for something else that I assume has something to do with that 72 and 27.
Is there some hint or some such thing that i need to specify in order to make the entire 1920 by 1080 of the screen available for rendering?
So far I've tried this (including your suggestion, EthanKim8683, and some from others).
GLFWmonitor *monitor = glfwGetPrimaryMonitor(); vid_mode = glfwGetVideoMode(monitor); printf("mode.width %d, mode.height %d\n", vid_mode->width, vid_mode->height); screen_x = vid_mode->width; screen_y = vid_mode->height; // screen_x = 640; screen_y = 480; // screen_x = 1600; screen_y = 900; glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_GREEN_BITS, vid_mode->greenBits); glfwWindowHint(GLFW_BLUE_BITS, vid_mode->blueBits); glfwWindowHint(GLFW_REFRESH_RATE, vid_mode->refreshRate); glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); window = glfwCreateWindow(screen_x, screen_y, window_title, monitor, nullptr); // Fullscreen glfwSetWindowAttrib(window, GLFW_DECORATED, GLFW_FALSE); glfwSetWindowSize(window, screen_x, screen_y); glfwSetWindowPos(window, 0, 0); glfwShowWindow(window);
The behavior is the same as reported before. There's these apparently inaccessible bands of screen real estate at the top and on the right side of the screen. But if I uncomment the line where I assign 1600 and 900 to screen_x and screen_y, the unaccessible bands disappear. The whole full screen shows the output of my application.