예제 #1
0
int main(void)
{
    int i;

    printf("Detecting processor information ...");
    fflush(stdout);
    printf("\n\n%s\n", CPU_getProcessorName());
    ZTimerInit();
    LZTimerOn();
    for (i = 0; i < LOOPS; i++) {
        PM_blockUntilTimeout(DELAY_MSECS);
        ReportTime(LZTimerLap());
        }
    LZTimerOff();
    return 0;
}
예제 #2
0
int gears2Test(
    GA_HGLRC glrc,
    int width,
    int height)
{
    ibool   done = false;
    int     initPageCount = 5;
    int     fpsRate = 0,key = 0,waitVRT = gaWaitVRT,pageCount = initPageCount;
    ulong   lastCount = 0,newCount;
    
    myinit();
    myReshape(width,height);
    LZTimerOn();
    while (!done) {
        oneFrame();
        gmoveto(0,0);
        gprintf("%d x %d %d bit %s (%d.%d fps)",(int)maxX+1,(int)maxY+1,
            (int)modeInfo.BitsPerPixel,
            (cntMode & gaLinearBuffer) ? "Linear" : "Banked",
            fpsRate / 10, fpsRate % 10);
        if (softwareOnly)             
            gprintf("Rendering to system memory back buffer");
        switch (waitVRT) {
            case gaTripleBuffer:
                gprintf("Triple buffering - should be no flicker");
                gprintf("Frame rate *must* max at refresh rate");
                break;
            case gaWaitVRT:
                gprintf("Double buffering - should be no flicker");
                gprintf("Frame rate *must* lock to multiple of refresh");
                break;
            default:
                gprintf("Page flipping (no wait) - may flicker");
                gprintf("Frame rate *must* max at hardware limit");
                break;
            }
        glFuncs.SwapBuffers(glrc,waitVRT);
        if (EVT_kbhit()) {
            key = EVT_getch();                /* Swallow keypress */
            if (key == 'v' || key == 'V') {
                waitVRT -= 1;
                if (modeInfo.Attributes & gaHaveTripleBuffer) {
                    if (waitVRT < gaTripleBuffer)
                        waitVRT = gaDontWait;
                    }
                else {
                    if (waitVRT < gaWaitVRT)
                        waitVRT = gaDontWait;
                    }
                }
            else                
                break;
            }
        /* Compute the frames per second rate after going through a large
         * number of pages. 
         */
        if (--pageCount == 0) {
            newCount = LZTimerLap();
            fpsRate = (int)(10000000L / (newCount - lastCount)) * initPageCount;
            lastCount = newCount;
            pageCount = initPageCount;
            }
        }
    LZTimerOff();
    return key;
}
예제 #3
0
파일: mech.c 프로젝트: kendallb/scitech-mgl
int mechTest(
    GA_HGLRC glrc,
    int width,
    int height)
{
    ibool   done = false;
    int     initPageCount = 5;
    int     fpsRate = 0,key = 0,waitVRT = gaWaitVRT,pageCount = initPageCount;
    ulong   lastCount = 0,newCount;
    event_t evt;

    myinit();
    myReshape(width,height);
    LZTimerOn();
    while (!done) {
        animation();
        display();
        gmoveto(0,0);
        gprintf("%d x %d %d bit %s (%d.%d fps)",(int)maxX+1,(int)maxY+1,
            (int)modeInfo.BitsPerPixel,
            (cntMode & gaLinearBuffer) ? "Linear" : "Banked",
            fpsRate / 10, fpsRate % 10);
        if (softwareOnly)
            gprintf("Rendering to system memory back buffer");
        switch (waitVRT) {
            case gaTripleBuffer:
                gprintf("Triple buffering - should be no flicker");
                gprintf("Frame rate *must* max at refresh rate");
                break;
            case gaWaitVRT:
                gprintf("Double buffering - should be no flicker");
                gprintf("Frame rate *must* lock to multiple of refresh");
                break;
            default:
                gprintf("Page flipping (no wait) - may flicker");
                gprintf("Frame rate *must* max at hardware limit");
                break;
            }
        glFuncs.SwapBuffers(glrc,waitVRT);
        if (EVT_kbhit()) {
            EVT_getNext(&evt,EVT_KEYDOWN | EVT_KEYREPEAT);
            EVT_flush(EVT_KEYREPEAT);
            key = EVT_asciiCode(evt.message);
            if (key == 'v' || key == 'V') {
                waitVRT -= 1;
                if (modeInfo.Attributes & gaHaveTripleBuffer) {
                    if (waitVRT < gaTripleBuffer)
                        waitVRT = gaDontWait;
                    }
                else {
                    if (waitVRT < gaWaitVRT)
                        waitVRT = gaDontWait;
                    }
                }
            else if (key == 0x1B || key == 0x0D || key == ' ') {
                done = true;
                }
            else {
                handleASCIICode(key);
                handleScanCode(EVT_scanCode(evt.message));
                }
            }
        /* Compute the frames per second rate after going through a large
         * number of pages.
         */
        if (--pageCount == 0) {
            newCount = LZTimerLap();
            fpsRate = (int)(10000000L / (newCount - lastCount)) * initPageCount;
            lastCount = newCount;
            pageCount = initPageCount;
            }
        }
    LZTimerOff();
    if (quadObj) {
        gluDeleteQuadric(quadObj);
        quadObj = NULL;
        }
    return key;
}
예제 #4
0
int bounceTest(
    GA_HGLRC glrc,
    int width,
    int height)
{
    ibool   done = false;
    int     initPageCount = 20;
    int     fpsRate = 0,key = 0,waitVRT = gaWaitVRT,pageCount = initPageCount;
    ulong   lastCount = 0,newCount;

    /* Init global variables */
    Zrot = 0.0;     Zstep = 4.0;
    Xpos = 0.0;     Ypos = 1.0;
    Xvel = 0.1;     Yvel = 0.0;
    Xmin = -4.0;    Xmax=4.0;
    Ymin = -3.8;    G = -0.05;

    /* Init ball and OpenGL rendering state */
    Ball = make_ball();
    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);
    glShadeModel(GL_FLAT);
    reshape(width,height);
    LZTimerOn();
    while (!done) {
        idle();
        gmoveto(0,0);
        gprintf("%d x %d %d bit %s (%d.%d fps)",(int)maxX+1,(int)maxY+1,
            (int)modeInfo.BitsPerPixel,
            (cntMode & gaLinearBuffer) ? "Linear" : "Banked",
            fpsRate / 10, fpsRate % 10);
        if (softwareOnly)             
            gprintf("Rendering to system memory back buffer");
        switch (waitVRT) {
            case gaTripleBuffer:
                gprintf("Triple buffering - should be no flicker");
                gprintf("Frame rate *must* max at refresh rate");
                break;
            case gaWaitVRT:
                gprintf("Double buffering - should be no flicker");
                gprintf("Frame rate *must* lock to multiple of refresh");
                break;
            default:
                gprintf("Page flipping (no wait) - may flicker");
                gprintf("Frame rate *must* max at hardware limit");
                break;
            }
        glFuncs.SwapBuffers(glrc,waitVRT);
        if (EVT_kbhit()) {
            key = EVT_getch();                /* Swallow keypress */
            if (key == 'v' || key == 'V') {
                waitVRT -= 1;
                if (modeInfo.Attributes & gaHaveTripleBuffer) {
                    if (waitVRT < gaTripleBuffer)
                        waitVRT = gaDontWait;
                    }
                else {
                    if (waitVRT < gaWaitVRT)
                        waitVRT = gaDontWait;
                    }
                }
            else                
                break;
            }
        /* Compute the frames per second rate after going through a large
         * number of pages. 
         */
        if (--pageCount == 0) {
            newCount = LZTimerLap();
            fpsRate = (int)(10000000L / (newCount - lastCount)) * initPageCount;
            lastCount = newCount;
            pageCount = initPageCount;
            }
        }
    LZTimerOff();
    return key;
}