Beispiel #1
0
void PerPixelRenderer::render(Renderable& rend)
{
    if(_released) {
        DefaultRenderer::render(rend);
        return;
    }

    glEnable(GL_TEXTURE_2D);
    //render shadow map
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    for(int i=0; i<MAX_LIGHTS; i++)
        if(glIsEnabled(GL_LIGHT0+i)) {
            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,_fboId[i]);
            glViewport(0,0,_w*_shadowRatio,_h*_shadowRatio);
            setupMatrices(i);
            setTextureMatrix(i);
            glCullFace(GL_FRONT);
            beforeShadowDraw(i);
            rend.drawObject();
            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,0);
            afterShadowDraw(i);
        }
    glMatrixMode(GL_MODELVIEW);
    glPopMatrix();
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();

    //render scene
    glViewport(0,0,_w,_h);
    glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    if(_showLight)drawLights();
    if(_shaderDraw)_shaderDraw->begin();
    beforeShadowRender(_shaderDraw);
    glCullFace(GL_BACK);
    rend.drawObject();
    if(_shaderDraw)_shaderDraw->end();
}
Beispiel #2
0
void DefaultRenderer::render(Renderable& rend)
{
    glViewport(0,0,_w,_h);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    rend.drawObject();
}