File: listmodes.c

package info (click to toggle)
glfw 2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,180 kB
  • ctags: 2,274
  • sloc: ansic: 16,424; sh: 424; asm: 306; makefile: 227; pascal: 86
file content (48 lines) | stat: -rw-r--r-- 1,333 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
}