Ejemplo n.º 1
0
Archivo: cApp.cpp Proyecto: stdmtb/n9
void cApp::draw(){
    mExp.begin( camUi.getCamera() );{
        gl::clear();
        gl::enableAlphaBlending();
        gl::pushMatrices();
        
        if( !mExp.bRender && !mExp.bSnap ){
            glLineWidth( 3 );
            mt::drawCoordinate(100);
        }
        if( mDg.mDot ){
            glPointSize( 1 );
            gl::draw( mDg.mDot );
        }
        
        gl::popMatrices();
        
    }mExp.end();

    if( bDrawLine ){
        mExp2.begin( camUi.getCamera() );{
            gl::clear();
            gl::enableAlphaBlending();
            gl::pushMatrices();
            if( mDg.mLine ){
                glLineWidth( 1 );
                gl::draw( mDg.mLine );
            }
            gl::popMatrices();
        }mExp2.end();
    }
    
    //gl::enableAdditiveBlending();
    gl::clear( ColorA(0,0,0,1) );
    gl::color( Color::white() );
    mExp.draw();
    if( bDrawLine )
        mExp2.draw();

    gl::drawString("Frame: " + to_string(frame), Vec2f(50, 50) );
    gl::drawString("simDirNum: " + to_string(simDirNum), Vec2f(50, 75) );
    gl::drawString("numParticle: " + to_string(numParticle), Vec2f(50, 100) );
    
    
#ifdef RENDER
    frame+=1;
#else
    frame+=1;
#endif

}
Ejemplo n.º 2
0
void cApp::draw(){
    
    gl::enableAlphaBlending();
    glPointSize(1);
    glLineWidth(1);
    
    //bOrtho ? mExp.beginOrtho( true ) : mExp.begin( camUi.getCamera() ); {
    {
        mExp.bind();
        gl::clear();
        gl::enableDepthRead();
        gl::enableDepthWrite();

        for( int i=0; i<6; i++){
            gl::pushMatrices();
            gl::setMatrices( cams[i] );
            
            if( !mExp.bRender && !mExp.bSnap ){
                mt::drawCoordinate(160);
            }
            
            rms[i].draw();
            
            gl::popMatrices();
        }
    }mExp.end();

    mExp.draw();

    if(gui) gui->draw();

    if( bStart)frame++;
}
Ejemplo n.º 3
0
void cApp::draw(){
    
    bOrtho ? mExp.beginOrtho( true ) : mExp.begin( camUi.getCamera() ); {
        
        gl::clear();    
        gl::enableDepthRead();
        gl::enableDepthWrite();
        gl::enableAlphaBlending();
        glPointSize(1);
        glLineWidth(1);
    
        if( !mExp.bRender && !mExp.bSnap ){ mt::drawCoordinate(10); }
        for( int i=0; i<rms.size(); i++){
            rms[rms.size()-i-1].draw();
        }
        
        norms.draw();
        
    }mExp.end();
    
    mExp.draw();
    
    if(gui) gui->draw();

    if( bStart && !bFall )frame++;
}
Ejemplo n.º 4
0
void cApp::draw(){
    
    //gl::setMatrices( camUi.getCamera() );
    mExp.begin( camUi.getCamera() );
    {
        gl::clear( Color(0,0,0) );
        gl::pointSize(1);
        gl::lineWidth(1);
        gl::enableAlphaBlending();

        gl::color(1,1,1);
        gl::TextureRef tex = gl::Texture::create( sur );
        gl::draw( tex );
        
        // feature key point
        //gl::enableAdditiveBlending();
        nline.draw();
        vbo.draw();
    }
    mExp.end();
    
    mExp.draw();
    
    frame+=1;
}
Ejemplo n.º 5
0
Archivo: cApp.cpp Proyecto: stdmtb/n9
void cApp::draw(){

    float transx = getWindowWidth()/2 - mFpb/2/2;
    float transy = getWindowHeight()/2;
    
    mExp.beginPersp();
    {
        gl::clear( Colorf(0,0,0) );
        
        glPushMatrix();
        {
            glTranslatef( transx, transy, 0 );
            
            for( int w=0; w<mWaves.size(); w++ ){

                for( int i=0; i<mWaves[w].posL.size(); i++ ){
                    
                    float noise = mPln.noise( mWaves[w].posR[i].y*mWaves[w].posL[i].y*0.5, i*0.5 );
                    if( noise<0.67 ){
                        glPointSize( 1 );
                    }else if( noise<0.72 ){
                        glPointSize( 2 );
                    }else if( noise<0.8 ){
                        glPointSize( 3 );
                    }else{
                        glPointSize( 1 );
                        gl::drawStrokedCircle( Vec2f(mWaves[w].posL[i].x, mWaves[w].posL[i].y), MAX(1, (noise-0.8f)*200.0f) );
                    }
                    
                    if(randFloat()<0.97f) glColor3f( mWaves[w].colorL[ i ].r, mWaves[w].colorL[ i ].g, mWaves[w].colorL[ i ].b );
                    else glColor3f(1, 0, 0);

                    glBegin( GL_POINTS );
                    glVertex2f( mWaves[w].posL[i].x,  mWaves[w].posL[i].y );
                    glEnd();
                    
                    if(randFloat()<0.97f) glColor3f( mWaves[w].colorR[i].r, mWaves[w].colorR[i].g, mWaves[w].colorR[i].b );
                    else glColor3f(1, 0, 0);

                    glBegin( GL_POINTS );
                    glVertex2f( mWaves[w].posR[i].x, mWaves[w].posR[i].y );
                    glEnd();
                }
            }
        }
        glPopMatrix();
        
    }
    mExp.end();
    

    gl::clear( Colorf(1,1,1) );
    gl::color( Colorf(1,1,1) );
    mExp.draw();
}
Ejemplo n.º 6
0
Archivo: cApp.cpp Proyecto: stdmtb/n9
void cApp::draw(){
    mExp.beginOrtho();{
        gl::clear();
        gl::enableAlphaBlending();
        glPushMatrix();
        gl::translate( mExp.mFbo.getWidth()/2, mExp.mFbo.getHeight()/2 );
        
        if( mExp.mFrame==1 || (!mExp.bRender && !mExp.bSnap) ){
            //guide.draw();
            mt::drawScreenGuide();
        }
        
        /*
            draw particle
        */
        glBegin( GL_POINTS );
        glPointSize(1);
        for( int i=0; i<ps.size(); i++ ){
            Vec2f & p = ps[i];
            ColorAf & c = cs[i];
            //ColorAf c( 0.7, 0.7, 0.7, 0.5 );
            glColor4f( c );
            
            glVertex2f( p );
        }
        glPopMatrix();
        glEnd();
        
        
    }mExp.end();

    gl::clear( ColorA(0,0,0,1) );
    gl::color( Color::white() );
    mExp.draw();

    gl::drawString("Frame: " + to_string(frame), Vec2f(50, 50) );
    
#ifdef RENDER
    frame+=1;
#else
    frame+=5;
#endif

}
Ejemplo n.º 7
0
Archivo: cApp.cpp Proyecto: stdmtb/n9
void cApp::draw(){

    mExp.begin( mCamUi.getCamera() );
    {
        gl::clear( Colorf(0,0,0) );
    
        if(0){
            glPushMatrix();
            glTranslatef( 5, 0, 0);
            gl::color(1, 1, 1);
            glBegin( GL_POINTS );
            for( int i=0; i<mSAs.size(); i++ ){
                for (int j=0; j<mSAs[i].points.size(); j++) {
                    glVertex3f( mSAs[i].points[j] );
                }
            }
            glEnd();
            glPopMatrix();
        }
        
        glPushMatrix();
        glTranslatef( -total*scale*0.5, 0, 0);
        gl::color(0, 0, 1, 0.35);
        glBegin( GL_POINTS );
        for( int i=0; i<mPlnPts.size(); i++ ){
            glVertex3f( mPlnPts[i] );
        }
        glEnd();
        glPopMatrix();
        
        glPushMatrix();
        glColor3f(1, 0, 0);
        glBegin( GL_LINES );
        glVertex3f(-100, 0, 0);
        glVertex3f(100, 0, 0);
        glEnd();
        glPopMatrix();
    }
    mExp.end();
    
    gl::clear( Colorf(1,1,1) );
    gl::color( Colorf(1,1,1) );
    mExp.draw();
}
Ejemplo n.º 8
0
Archivo: cApp.cpp Proyecto: stdmtb/n9
void cApp::draw(){

    mExp.beginOrtho();
    {
        gl::clear( Colorf(0,0,0) );
        gl::color( Colorf(1,0,0) );
        
        for( int i=0; i<axis.size(); i++){

            const n5::Axis & ax = axis[i];
            
            glPointSize(5);
            glLineWidth(2);
            glColor3f( 0.1,0.1,0.1 );
            
            // draw rail
            glBegin( GL_LINES );
            glVertex3f( ax.left.x, ax.left.y, 0 );
            glVertex3f( ax.left.x+ax.length, ax.left.y, 0);
            glEnd();
            
            // draw point
            bool on = (ax.power>200);
            on ? glColor3f( 1,0,0 ) : glColor3f( 0.3,0.3,0.3 );
            if( on ) gl::drawStrokedCircle(ax.pos, 30);

            glBegin( GL_POINTS );
            glVertex2f( ax.pos );
            glEnd();
        }
    }
    mExp.end();

    mExp.draw();
    gl::color(1, 1, 1);
    gl::drawString("frame : " + to_string(frame), Vec2i(10,10) );
    
    frame++;
}
Ejemplo n.º 9
0
Archivo: cApp.cpp Proyecto: stdmtb/n9
void cApp::draw(){
    mExp.begin( camUi.getCamera() );{
        
        gl::clear();
        gl::enableAlphaBlending();
        gl::pushMatrices();

        glPointSize( 1 );
        for( auto & v : vbo){
            v.draw();
        }
        gl::popMatrices();
        
    }mExp.end();

    gl::clear( ColorA(1,1,1,1) );
    gl::color( Color::white() );
    mExp.draw();
    
    gl::drawString("Frame: " + to_string(frame), Vec2f(50, 50) );
    frame++;
}
Ejemplo n.º 10
0
void cApp::draw(){
    glPointSize(1);
    glLineWidth(1);
    gl::enableAlphaBlending();
    
    mExp.begin(camui.getCamera());{
        gl::clear();
        mt::drawCoordinate(100);
        vbo.draw();
    }
    mExp.end();
    
    mExp.draw();
    
    gl::pushMatrices();
    {
        gl::color(1, 1, 1);
        gl::drawString("fps      " + to_string( getAverageFps()),   vec2(20,20) );
        gl::drawString("frame    " + to_string( frame ),   vec2(20,35) );
    }
    gl::popMatrices();
    
}
Ejemplo n.º 11
0
void cApp::draw(){
    
    mExp.begin( camUi.getCamera() );{
        gl::clear( ColorA(0,0,0,1) );
        gl::enableAlphaBlending();
        gl::enableDepthRead();
        gl::enableDepthWrite();
        
        if( !mExp.bSnap && !mExp.bRender ){
            // Guide
            mt::drawCoordinate( 100 );
        }
        
        glPointSize( 1 );
        gl::translate( -intensityW/2, -intensityH/2 );
        gl::draw( mPoints );
        
        
    }mExp.end();
    
    gl::clear( ColorA(1,1,1,1) );
    gl::color( Color::white() );
    mExp.draw();
}