Beispiel #1
0
void GlutDisplay()
{
    switch ( viewMode ) {
        case VIEWMODE_OPENGL:
            if ( dofImage ) {
                if ( dofDrawCount < MAX_DOF_DRAW ) {
                    DrawScene();
                    glReadPixels( 0, 0, camera.imgWidth, camera.imgHeight, GL_RGB, GL_UNSIGNED_BYTE, dofBuffer );
                    for ( int i=0; i<camera.imgWidth*camera.imgHeight; i++ ) {
                        dofImage[i] = (dofImage[i]*dofDrawCount + dofBuffer[i].ToColor())/(dofDrawCount+1);
                    }
                    dofDrawCount++;
                }
                glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
                glDrawPixels( camera.imgWidth, camera.imgHeight, GL_RGB, GL_FLOAT, dofImage );
                if ( dofDrawCount < MAX_DOF_DRAW ) {
                    DrawProgressBar(float(dofDrawCount)/MAX_DOF_DRAW);
                    glutPostRedisplay();
                }
            } else {
                DrawScene();
            }
            break;
        case VIEWMODE_IMAGE:
            glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
            glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_RGB, GL_UNSIGNED_BYTE, renderImage.GetPixels() );
            DrawRenderProgressBar();
            break;
        case VIEWMODE_Z:
            glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
            if ( ! renderImage.GetZBufferImage() ) renderImage.ComputeZBufferImage();
            glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_LUMINANCE, GL_UNSIGNED_BYTE, renderImage.GetZBufferImage() );
            break;
        case VIEWMODE_SAMPLECOUNT:
            glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
            if ( ! renderImage.GetSampleCountImage() ) renderImage.ComputeSampleCountImage();
            glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_LUMINANCE, GL_UNSIGNED_BYTE, renderImage.GetSampleCountImage() );
            break;
        case VIEWMODE_IRRADCOMP:
            glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
            if ( renderImage.GetIrradianceComputationImage() ) {
                glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_LUMINANCE, GL_UNSIGNED_BYTE, renderImage.GetIrradianceComputationImage() );
            }
            break;
    }
    
    glutSwapBuffers();
}
Beispiel #2
0
void GlutDisplay()
{
	switch ( viewMode ) {
	case VIEWMODE_OPENGL:
		DrawScene();
		break;
	case VIEWMODE_IMAGE:
		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
		glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_RGB, GL_UNSIGNED_BYTE, renderImage.GetPixels() );
		DrawRenderProgressBar();
		break;
	case VIEWMODE_Z:
		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
		if ( ! renderImage.GetZBufferImage() ) renderImage.ComputeZBufferImage();
		glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_LUMINANCE, GL_UNSIGNED_BYTE, renderImage.GetZBufferImage() );
		break;
	}

	glutSwapBuffers();
}