コード例 #1
0
ファイル: testFboVP.cpp プロジェクト: mlimper/OpenSG1x
// redraw the window
void display(void)
{
    WindowPtr win = mgr->getWindow();
    
    //mgr->redraw();
    win->activate();
    win->frameInit();
    
    //RenderAction *rAct = (RenderAction*)mgr->getAction();
    
    if (multipass)
    {
        RenderAction *rAct = RenderAction::create();
        
        fbo_vp->setParent(win);
        
        rAct->setWindow(get_pointer(win));
        
        fbo_vp->render(rAct);
        
        fbo_vp->setParent(NullFC);
        
        delete rAct;
        
        //multipass = false;
    }

    win->getPort(0)->render(dynamic_cast<RenderAction *>(mgr->getAction()));
    //win->renderAllViewports(rAct);

    win->swap();
    win->frameExit();
    win->deactivate();
}
コード例 #2
0
void
display(void)
{
    float t = glutGet( GLUT_ELAPSED_TIME );

    win->frameInit();

    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    Matrix m;
    Quaternion q;
    q.setValueAsAxisDeg( 0,1,0, -t/20 );
    m.setRotate( q );
    tchunk1->setMatrix( m );

    tchunk1->activate( dact );
    mchunk1->activate( dact );

    glCallList( dlid );

    m.setIdentity();
    m.setTranslate( cos(t/1000), 0, sin(t/1000) );
    tchunk2->setMatrix( m );


    tchunk2->changeFrom( dact, get_pointer(tchunk1));
    mchunk2->changeFrom( dact, get_pointer(mchunk1));
    blchunk->activate( dact );
    blchunk->activate( dact );
    cchunk1->activate( dact );
    gchunk1->activate( dact );

    glCallList( dlid );

    tchunk2->deactivate( dact );
    mchunk2->deactivate( dact );
    blchunk->deactivate( dact );
    cchunk1->deactivate( dact );
    gchunk1->deactivate( dact );

    xchunk1->activate( dact );
    txchunk->activate( dact );

    glCallList( dlid2 );

    xchunk1->deactivate( dact );
    txchunk->deactivate( dact );

    win->frameExit();

    glutSwapBuffers();
}
コード例 #3
0
void
display(void)
{
    float t = glutGet( GLUT_ELAPSED_TIME );

    win->frameInit();

    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    Matrix m;
    Quaternion q;
    q.setValueAsAxisDeg( 0,1,0, -t/20 );
    m.setRotate( q );
    tchunk1->setMatrix( m );

    tchunk1->activate( dact );
    mchunk1->activate( dact );
    pchunk1->activate( dact );
    lichunk1->activate( dact );

    glCallList( dlid );

    m.setIdentity();
    m.setTranslate( cos(t/1000), 0, sin(t/1000) );
    tchunk2->setMatrix( m );


    pchunk2->changeFrom( dact, get_pointer(pchunk1) );
    tchunk2->changeFrom( dact, get_pointer(tchunk1) );
    mchunk2->changeFrom( dact, get_pointer(mchunk1) );
    lichunk2->changeFrom( dact, get_pointer(lichunk1) );
    blchunk->activate( dact );

    glCallList( dlid );

    tchunk2->deactivate( dact );
    mchunk2->deactivate( dact );
    pchunk2->deactivate( dact );
    lichunk2->deactivate( dact );
    blchunk->deactivate( dact );


    xchunk1->activate( dact );
    txchunk->activate( dact );

#if 0
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_PASS_THROUGH_NV);
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV,34102
);
glTexEnvf(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_SCALE_NV, 0.0000 );
glTexEnvf(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_BIAS_NV, 0.0000 );

glEnable(GL_TEXTURE_SHADER_NV);
GLint consistent;
glGetTexEnviv(GL_TEXTURE_SHADER_NV, GL_SHADER_CONSISTENT_NV,
      &consistent);
if(!consistent)
{
    FWARNING(("Texture shaders not consistent!\n"));
}
#endif
   
    glCallList( dlid2 );

// glDisable(GL_TEXTURE_SHADER_NV);
    xchunk1->deactivate( dact );
    txchunk->deactivate( dact );

    win->frameExit();

    glutSwapBuffers();
}