コード例 #1
0
int _glfwGetClosestVideoMode( int *w, int *h, int *r, int *g, int *b,
                              int refresh )
{
    int                  modeID;

    // Find best mode
    modeID = BestModeID(
        BIDTAG_NominalWidth,    *w,
        BIDTAG_NominalHeight,   *h,
        BIDTAG_Depth,           *r + *g + *b,
        BIDTAG_RedBits,         *r,
        BIDTAG_GreenBits,       *g,
        BIDTAG_BlueBits,        *b,
        TAG_DONE, 0
    );

    // Did we get a proper mode?
    if( !modeID )
    {
        return 0;
    }

    // Get actual display info
    _glfwGetModeIDInfo( modeID, w, h, r, g, b, NULL );

    return modeID;
}
コード例 #2
0
ファイル: amigaos_window.c プロジェクト: jaekim708/kiss
void _glfwPlatformRefreshWindowParams( void )
{
    int       refresh;
    GLint     x;
    GLboolean b;

    // This function is not proerly implemented yet. We use OpenGL for
    // getting framebuffer format information - we should use some
    // alternate interface (such as glX under the X Window System), but
    // StormMesa does not seem to provide this.

    // Fill out information
    _glfwWin.Accelerated    = GL_TRUE;
    glGetIntegerv( GL_RED_BITS, &x );
    _glfwWin.RedBits        = x;
    glGetIntegerv( GL_GREEN_BITS, &x );
    _glfwWin.GreenBits      = x;
    glGetIntegerv( GL_BLUE_BITS, &x );
    _glfwWin.BlueBits       = x;
    glGetIntegerv( GL_ALPHA_BITS, &x );
    _glfwWin.AlphaBits      = x;
    glGetIntegerv( GL_DEPTH_BITS, &x );
    _glfwWin.DepthBits      = x;
    glGetIntegerv( GL_STENCIL_BITS, &x );
    _glfwWin.StencilBits    = x;
    glGetIntegerv( GL_ACCUM_RED_BITS, &x );
    _glfwWin.AccumRedBits   = x;
    glGetIntegerv( GL_ACCUM_GREEN_BITS, &x );
    _glfwWin.AccumGreenBits = x;
    glGetIntegerv( GL_ACCUM_BLUE_BITS, &x );
    _glfwWin.AccumBlueBits  = x;
    glGetIntegerv( GL_ACCUM_ALPHA_BITS, &x );
    _glfwWin.AccumAlphaBits = x;
    glGetIntegerv( GL_AUX_BUFFERS, &x );
    _glfwWin.AuxBuffers     = x;
    glGetBooleanv( GL_AUX_BUFFERS, &b );
    _glfwWin.Stereo         = b ? GL_TRUE : GL_FALSE;

    // Get ModeID information (refresh rate)
    _glfwGetModeIDInfo( _glfwWin.ModeID, NULL, NULL, NULL, NULL, NULL,
                        &refresh );
    _glfwWin.RefreshRate    = refresh;
}
コード例 #3
0
void _glfwPlatformGetDesktopMode( GLFWvidmode *mode )
{
    struct Screen        *pubscreen;
    ULONG                modeID;

    // Get default public screen screen handle
    pubscreen = LockPubScreen( NULL );

    // Get screen width and height (use actual screen size rather than
    // ModeID nominal size)
    mode->Width  = (int) pubscreen->Width;
    mode->Height = (int) pubscreen->Height;

    // Get ModeID for public screen
    modeID = GetVPModeID( &pubscreen->ViewPort );

    // Release workbench screen
    UnlockPubScreen( NULL, pubscreen );

    // Get color bits information
    _glfwGetModeIDInfo( modeID, NULL, NULL, &mode->RedBits,
                        &mode->GreenBits, &mode->BlueBits, NULL );
}
コード例 #4
0
int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
{
    ULONG modeID;
    int   w, h, r, g, b, bpp, m1, m2, i, j, count;

    count  = 0;
    modeID = INVALID_ID;
    do
    {
        // Enumarate all ModeIDs with NextDisplayInfo
        modeID = NextDisplayInfo( modeID );
        if( modeID != INVALID_ID )
        {
            // Get related video mode information
            _glfwGetModeIDInfo( modeID, &w, &h, &r, &g, &b, NULL );

            // Convert RGB to BPP
            bpp = r + g + b;

            // We only support true-color modes, which means at least 15
            // bits per pixel (reasonable?) - Sorry, AGA users!
            if( bpp >= 15 )
            {
                // Mode "code" for this mode
                m1 = (bpp << 25) | (w*h);

                // Insert mode in list (sorted), and avoid duplicates
                for( i = 0; i < count; i ++ )
                {
                    // Mode "code" for already listed mode
                    bpp = list[i].RedBits + list[i].GreenBits +
                          list[i].BlueBits;
                    m2 = (bpp << 25) | (list[i].Width * list[i].Height);
                    if( m1 <= m2 )
                    {
                        break;
                    }
                }

                // New entry at the end of the list?
                if( i >= count )
                {
                    list[count].Width     = w;
                    list[count].Height    = h;
                    list[count].RedBits   = r;
                    list[count].GreenBits = g;
                    list[count].BlueBits  = b;
                    count ++;
                }
                // Insert new entry in the list?
                else if( m1 < m2 )
                {
                    for( j = count; j > i; j -- )
                    {
                        list[j] = list[j-1];
                    }
                    list[i].Width     = w;
                    list[i].Height    = h;
                    list[i].RedBits   = r;
                    list[i].GreenBits = g;
                    list[i].BlueBits  = b;
                    count ++;
                }
            }
        }
    }
    while( modeID != INVALID_ID && count < maxcount );

    return count;
}