Skip to content

Instantly share code, notes, and snippets.

@CounterPillow
Created February 27, 2016 16:07
Show Gist options
  • Save CounterPillow/5b8fc6ed7b21d2df88e9 to your computer and use it in GitHub Desktop.
Save CounterPillow/5b8fc6ed7b21d2df88e9 to your computer and use it in GitHub Desktop.
#include <GLFW/glfw3.h>
#include <stdio.h>
int main() {
if (!glfwInit())
return(-1);
int monitor_count;
GLFWmonitor** monitors = glfwGetMonitors(&monitor_count);
GLFWmonitor* primary = glfwGetPrimaryMonitor();
for(int i = 0; i < monitor_count; i++) {
GLFWmonitor* mon = monitors[i];
printf("Monitor %d, \"%s\"", i, glfwGetMonitorName(mon));
if (mon == primary) {
printf(" (Primary)");
}
printf("\n");
int count;
const GLFWvidmode* modes = glfwGetVideoModes(mon, &count);
for(int j = 0; j < count; j++) {
GLFWvidmode mode = modes[j];
printf("%dx%d @%dHz\n", mode.width, mode.height, mode.refreshRate);
}
printf("\n");
}
glfwTerminate();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment