tests/cuda2.2/tests/VolumeRender/volumeRender.cpp
void display()
{
    cutilCheckError(cutStartTimer(timer));  

    // use OpenGL to build view matrix
    GLfloat modelView[16];
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
        glLoadIdentity();
        glRotatef(-viewRotation.x, 1.0, 0.0, 0.0);
        glRotatef(-viewRotation.y, 0.0, 1.0, 0.0);
        glTranslatef(-viewTranslation.x, -viewTranslation.y, -viewTranslation.z);
    glGetFloatv(GL_MODELVIEW_MATRIX, modelView);
    glPopMatrix();

    invViewMatrix[0] = modelView[0]; invViewMatrix[1] = modelView[4]; invViewMatrix[2] = modelView[8]; invViewMatrix[3] = modelView[12];
    invViewMatrix[4] = modelView[1]; invViewMatrix[5] = modelView[5]; invViewMatrix[6] = modelView[9]; invViewMatrix[7] = modelView[13];
    invViewMatrix[8] = modelView[2]; invViewMatrix[9] = modelView[6]; invViewMatrix[10] = modelView[10]; invViewMatrix[11] = modelView[14];

    render();

    // display results
    glClear(GL_COLOR_BUFFER_BIT);

    // draw image from PBO
    glDisable(GL_DEPTH_TEST);
    glRasterPos2i(0, 0);
    glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbo);
    glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_BYTE, 0);
    glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);


    if (g_CheckRender && g_CheckRender->IsQAReadback() && g_Verify) {
        // readback for QA testing
        printf("> (Frame %d) Readback BackBuffer\n", frameCount);
        g_CheckRender->readback( width, height );
        g_CheckRender->savePPM(sOriginal[g_Index], true, NULL);
        if (!g_CheckRender->PPMvsPPM(sOriginal[g_Index], sReference[g_Index], MAX_EPSILON_ERROR, 0.20f)) {
            g_TotalErrors++;
        }
        else
        {
        	printf("TEST PASSED\n");
        }
        g_Verify = false;
    }
    glutSwapBuffers();
    glutReportErrors();

    cutilCheckError(cutStopTimer(timer));  

    computeFPS();
}
// display results using OpenGL (called by GLUT)
display results using OpenGL (called by GLUT)
display results using OpenGL ( called by GLUT )
void display()
{
    cutilCheckError(cutStartTimer(timer));  
    GLfloat modelView[16];
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
        glLoadIdentity();
        glRotatef(-viewRotation.x, 1.0, 0.0, 0.0);
        glRotatef(-viewRotation.y, 0.0, 1.0, 0.0);
        glTranslatef(-viewTranslation.x, -viewTranslation.y, -viewTranslation.z);
    glGetFloatv(GL_MODELVIEW_MATRIX, modelView);
    glPopMatrix();
    invViewMatrix[0] = modelView[0]; invViewMatrix[1] = modelView[4]; invViewMatrix[2] = modelView[8]; invViewMatrix[3] = modelView[12];
    invViewMatrix[4] = modelView[1]; invViewMatrix[5] = modelView[5]; invViewMatrix[6] = modelView[9]; invViewMatrix[7] = modelView[13];
    invViewMatrix[8] = modelView[2]; invViewMatrix[9] = modelView[6]; invViewMatrix[10] = modelView[10]; invViewMatrix[11] = modelView[14];
    render();
    glClear(GL_COLOR_BUFFER_BIT);
    glDisable(GL_DEPTH_TEST);
    glRasterPos2i(0, 0);
    glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbo);
    glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_BYTE, 0);
    glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
    if (g_CheckRender && g_CheckRender->IsQAReadback() && g_Verify) {
        printf("> (Frame %d) Readback BackBuffer\n", frameCount);
        g_CheckRender->readback( width, height );
        g_CheckRender->savePPM(sOriginal[g_Index], true, NULL);
        if (!g_CheckRender->PPMvsPPM(sOriginal[g_Index], sReference[g_Index], MAX_EPSILON_ERROR, 0.20f)) {
            g_TotalErrors++;
        }
        else
        {
        	printf("TEST PASSED\n");
        }
        g_Verify = false;
    }
    glutSwapBuffers();
    glutReportErrors();
    cutilCheckError(cutStopTimer(timer));  
    computeFPS();
}
void display ( ) { cutilCheckError ( cutStartTimer ( timer ) ) ; GLfloat modelView [ 16 ] ; glMatrixMode ( GL_MODELVIEW ) ; glPushMatrix ( ) ; glLoadIdentity ( ) ; glRotatef ( - viewRotation . x , 1.0 , 0.0 , 0.0 ) ; glRotatef ( - viewRotation . y , 0.0 , 1.0 , 0.0 ) ; glTranslatef ( - viewTranslation . x , - viewTranslation . y , - viewTranslation . z ) ; glGetFloatv ( GL_MODELVIEW_MATRIX , modelView ) ; glPopMatrix ( ) ; invViewMatrix [ 0 ] = modelView [ 0 ] ; invViewMatrix [ 1 ] = modelView [ 4 ] ; invViewMatrix [ 2 ] = modelView [ 8 ] ; invViewMatrix [ 3 ] = modelView [ 12 ] ; invViewMatrix [ 4 ] = modelView [ 1 ] ; invViewMatrix [ 5 ] = modelView [ 5 ] ; invViewMatrix [ 6 ] = modelView [ 9 ] ; invViewMatrix [ 7 ] = modelView [ 13 ] ; invViewMatrix [ 8 ] = modelView [ 2 ] ; invViewMatrix [ 9 ] = modelView [ 6 ] ; invViewMatrix [ 10 ] = modelView [ 10 ] ; invViewMatrix [ 11 ] = modelView [ 14 ] ; render ( ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; glDisable ( GL_DEPTH_TEST ) ; glRasterPos2i ( 0 , 0 ) ; glBindBufferARB ( GL_PIXEL_UNPACK_BUFFER_ARB , pbo ) ; glDrawPixels ( width , height , GL_RGBA , GL_UNSIGNED_BYTE , 0 ) ; glBindBufferARB ( GL_PIXEL_UNPACK_BUFFER_ARB , 0 ) ; if ( g_CheckRender && g_CheckRender -> IsQAReadback ( ) && g_Verify ) { printf ( " \n " , frameCount ) ; g_CheckRender -> readback ( width , height ) ; g_CheckRender -> savePPM ( sOriginal [ g_Index ] , true , NULL ) ; if ( ! g_CheckRender -> PPMvsPPM ( sOriginal [ g_Index ] , sReference [ g_Index ] , MAX_EPSILON_ERROR , 0.20f ) ) { g_TotalErrors ++ ; } else { printf ( " \n " ) ; } g_Verify = false ; } glutSwapBuffers ( ) ; glutReportErrors ( ) ; cutilCheckError ( cutStopTimer ( timer ) ) ; computeFPS ( ) ; }
display results using OpenGL (called by GLUT)
display results using OpenGL ( called by GLUT )
// use OpenGL to build view matrix // display results // draw image from PBO // readback for QA testing