void MultiDrawIndirect::RenderC()
{
    glViewport(0, 0, NvSampleApp::m_width, NvSampleApp::m_height);

    glClearColor(1.0f, 1.0f, 0.0f, 0.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    {
        CPU_TIMER_SCOPE();
        GPU_TIMER_SCOPE();
    DrawSkyboxColorDepth();

        DrawModelColorDepth();
    }

    glDepthMask(false);

    m_ProjectionMatrixChanged = false;

    glDepthMask(true);
}
示例#2
0
void SceneRenderer::renderFrame()
{
    m_fbos->updateBuffers();

    // Update screen FBO
    glGetIntegerv(0x8CA6, (GLint*)&(m_fbos->m_backBufferFbo->fbo));

    CPU_TIMER_SCOPE(CPU_TIMER_TOTAL);
    GPU_TIMER_SCOPE(GPU_TIMER_TOTAL);

    MatrixStorage mats;
    setupMatrices(mats);
    
    {
        // render a full-screen depth pass.
        CPU_TIMER_SCOPE(CPU_TIMER_SCENE_DEPTH);
        GPU_TIMER_SCOPE(GPU_TIMER_SCENE_DEPTH);
        if (m_params.useDepthPrepass)
            renderSceneDepth(mats, m_fbos->m_sceneFbo);

        // render scene depth to buffer for particle to be depth tested against
        // This may just down-sample the above depth pre-pass.
        renderLowResSceneDepth(mats);
        CHECK_GL_ERROR();
    }

    {
        // the opaque colors need to be rendered after the particles
        //LOGI("OE renderFullResSceneColor\n");
        CPU_TIMER_SCOPE(CPU_TIMER_SCENE_COLOR);
        GPU_TIMER_SCOPE(GPU_TIMER_SCENE_COLOR);
        renderFullResSceneColor(mats);
        CHECK_GL_ERROR();
    }
    
    if (m_particles->getParams().render)
    {
        CPU_TIMER_SCOPE(CPU_TIMER_PARTICLES);
        GPU_TIMER_SCOPE(GPU_TIMER_PARTICLES);
        renderParticles(mats);
        CHECK_GL_ERROR();

        if (m_particles->getParams().renderLowResolution)
        {
            // upsample the particles & composite them on top of the opaque scene colors
            CPU_TIMER_SCOPE(CPU_TIMER_UPSAMPLE_PARTICLES);
            GPU_TIMER_SCOPE(GPU_TIMER_UPSAMPLE_PARTICLES);
            m_upsampler->upsampleParticleColors(*m_fbos->m_sceneFbo);
            CHECK_GL_ERROR();
        }
    }
    
    {
        // final bilinear upsampling from scene resolution to backbuffer resolution
        CPU_TIMER_SCOPE(CPU_TIMER_UPSAMPLE_SCENE);
        GPU_TIMER_SCOPE(GPU_TIMER_UPSAMPLE_SCENE);
        m_upsampler->upsampleSceneColors(*m_fbos->m_backBufferFbo);
        CHECK_GL_ERROR();
    }

    m_particles->swapBuffers();
}