2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
|
|
|
// This is a small test application for GLFW.
|
|
|
|
// The program lists all available fullscreen video modes.
|
|
|
|
//========================================================================
|
|
|
|
|
2010-09-10 13:16:03 +02:00
|
|
|
#include <GL/glfw3.h>
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2011-09-19 20:36:01 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2011-09-19 20:36:01 +02:00
|
|
|
static void print_mode(GLFWvidmode* mode)
|
|
|
|
{
|
|
|
|
printf("%i x %i x %i (%i %i %i)\n",
|
|
|
|
mode->width, mode->height,
|
|
|
|
mode->redBits + mode->greenBits + mode->blueBits,
|
|
|
|
mode->redBits, mode->greenBits, mode->blueBits);
|
|
|
|
}
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2011-09-19 20:36:01 +02:00
|
|
|
int main(void)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2011-10-03 09:24:35 +02:00
|
|
|
GLFWmonitor monitorHandle;
|
2011-09-19 20:36:01 +02:00
|
|
|
GLFWvidmode dtmode, modes[400];
|
|
|
|
int modecount, i;
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2011-09-19 20:36:01 +02:00
|
|
|
if (!glfwInit())
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2011-09-19 20:36:01 +02:00
|
|
|
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
|
|
|
exit(EXIT_FAILURE);
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Show desktop video mode
|
2011-09-19 20:36:01 +02:00
|
|
|
glfwGetDesktopMode(&dtmode);
|
|
|
|
printf("Desktop mode: ");
|
|
|
|
print_mode(&dtmode);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2011-10-03 09:24:35 +02:00
|
|
|
monitorHandle = GLFW_MONITOR_INVALID_HANDLE;
|
2011-05-07 10:53:50 +02:00
|
|
|
|
2011-10-03 09:24:35 +02:00
|
|
|
while( GLFW_MONITOR_INVALID_HANDLE != ( monitorHandle = glfwGetNextMonitor( monitorHandle )))
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2011-10-03 09:24:35 +02:00
|
|
|
printf( "Monitor name: %s\n"
|
2011-05-07 10:53:50 +02:00
|
|
|
"Physical dimensions: %dmm x %dmm\n"
|
|
|
|
"Logical position: (%d,%d)\n",
|
2011-10-03 09:24:35 +02:00
|
|
|
glfwGetMonitorStringParam( monitorHandle, GLFW_MONITOR_PARAM_S_NAME ),
|
|
|
|
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_PHYS_WIDTH ),
|
|
|
|
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_PHYS_HEIGHT ),
|
|
|
|
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_SCREEN_X_POS ),
|
|
|
|
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_SCREEN_Y_POS )
|
2011-05-07 10:53:50 +02:00
|
|
|
);
|
|
|
|
// List available video modes
|
2011-10-03 09:24:35 +02:00
|
|
|
modecount = glfwGetVideoModes(monitorHandle, modes, sizeof(modes) / sizeof(GLFWvidmode));
|
2011-05-07 10:53:50 +02:00
|
|
|
printf( "Available modes:\n" );
|
|
|
|
for( i = 0; i < modecount; i ++ )
|
|
|
|
{
|
|
|
|
printf("%3i: ", i);
|
|
|
|
print_mode(modes + i);
|
|
|
|
}
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
|
|
|
glfwTerminate();
|
2011-09-19 20:36:01 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
2011-09-19 20:36:01 +02:00
|
|
|
|