Mandar
Mandar

Reputation: 1044

how to get all supported resolution for multi monitor using FREEGLUT?

I have windows code which creates a list of available resolution for multiple monitors.

Now I have to port it on Linux so i am thinking to use "FREEGLUT" so that I can get monitor related information for Linux and windows using same code.

I need help to get some pointer to get all supported resolution of multiple monitors..?

I hope we can do it using free glut..

Upvotes: 0

Views: 764

Answers (2)

Mandar
Mandar

Reputation: 1044

I am using GLFW 3.0.4 to get supported resolution of multiple monitor. I preferred using platform specific function to apply monitor resolutions.

// Get Resolution of Multimonitor
int totalMonitor;
GLFWmonitor** monitors = glfwGetMonitors(&totalMonitor);


printf("\n\n---------------------------------------------------------");
printf("\n Total monitor [%d]",totalMonitor);

printf("\n primary monitor [%s]",glfwGetMonitorName(glfwGetPrimaryMonitor()));
printf("\n\n---------------------------------------------------------");

for(int currMonitor=0;currMonitor<totalMonitor;currMonitor++)
{
    printf("\n monitor name: [%s]",glfwGetMonitorName(monitors[currMonitor]));      

    int count;
    const GLFWvidmode* modes = glfwGetVideoModes(monitors[currMonitor], &count);

    for (int i = 0; i < count; i++)
    {
        printf("\n  %d : [%d X %d]~[%d]",i,modes[i].width,modes[i].height,modes[i].refreshRate);
    }

    printf("\n---------------------------------------------------------");
}

Upvotes: 0

datenwolf
datenwolf

Reputation: 162269

Linux by itself has no graphics system. You have to rely on something like X11 or Wayland. Right now X11 is the system usually found and the X11-API for enumerating and configuring monitors is called XRandR. FreeGLUT does not really expose this functionality. So either use a framework that does or implement it yourself.

Note that when it comes to multi monitor environments, the Window Manager also has a say about window placement.

Upvotes: 1

Related Questions