diff options
author | Éloi Rivard <azmeuk@gmail.com> | 2013-03-04 13:11:44 +0100 |
---|---|---|
committer | Éloi Rivard <azmeuk@gmail.com> | 2013-04-04 11:17:36 +0200 |
commit | 656bba1da1024c5b35936b0d375f27f14f8701e3 (patch) | |
tree | ea85ad05465ce379387b6e9a3c44c9b10cec61ed /tests/glfw/listmodes.c | |
parent | 1613b96ed8d1f85b8c58fa0da6c0527075d01d82 (diff) |
* Added glfw headers and testcases.
Diffstat (limited to 'tests/glfw/listmodes.c')
-rw-r--r-- | tests/glfw/listmodes.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/glfw/listmodes.c b/tests/glfw/listmodes.c new file mode 100644 index 00000000..717cfde0 --- /dev/null +++ b/tests/glfw/listmodes.c @@ -0,0 +1,48 @@ +//======================================================================== +// This is a small test application for GLFW. +// The program lists all available fullscreen video modes. +//======================================================================== + +#include <stdio.h> +#include <GL/glfw.h> + +// Maximum number of modes that we want to list +#define MAX_NUM_MODES 400 + + +//======================================================================== +// main() +//======================================================================== + +int main( void ) +{ + GLFWvidmode dtmode, modes[ MAX_NUM_MODES ]; + int modecount, i; + + // Initialize GLFW + if( !glfwInit() ) + { + return 0; + } + + // Show desktop video mode + glfwGetDesktopMode( &dtmode ); + printf( "Desktop mode: %d x %d x %d\n\n", + dtmode.Width, dtmode.Height, dtmode.RedBits + + dtmode.GreenBits + dtmode.BlueBits ); + + // List available video modes + modecount = glfwGetVideoModes( modes, MAX_NUM_MODES ); + printf( "Available modes:\n" ); + for( i = 0; i < modecount; i ++ ) + { + printf( "%3d: %d x %d x %d\n", i, + modes[i].Width, modes[i].Height, modes[i].RedBits + + modes[i].GreenBits + modes[i].BlueBits ); + } + + // Terminate GLFW + glfwTerminate(); + + return 0; +} |