void cApp::draw(){ gl::clear(); gl::enableAlphaBlending(); gl::setMatrices( camUi.getCamera() ); gl::translate( -getWindowWidth()*0.4f, 0, 0); gl::pointSize(1); gl::translate(0, 400, 0); gl::color(1, 1, 1); gl::drawLine(vec3(0,100,0), vec3(0,-100,0) ); vWav.draw(); gl::pointSize(3); gl::translate(0, -200, 0); vMag.draw(); gl::pointSize(1); gl::translate(0, -200, 0); gl::drawLine(vec3(0,100,0), vec3(0,-100,0) ); vWav_inv.draw(); gl::translate(0, -400, 0); gl::pointSize(2); gl::drawLine(vec3(-200,0,0), vec3(200,0,0) ); gl::drawLine(vec3(0,200,0), vec3(0,-200,0) ); vSpec.draw(); }
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++; }
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; }
void cApp::keyDown( KeyEvent event ) { char key = event.getChar(); switch (key) { case 'S': mExp.startRender(); break; case 'T': mExp.stopRender(); break; case 's': mExp.snapShot(); break; case ' ': bStart = !bStart; break; case 'c': mt::printCamera( camUi.getCamera() ); break; } }
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(); }
void cApp::resize(){ CameraPersp & cam = const_cast<CameraPersp&>(camUi.getCamera()); cam.setAspectRatio( getWindowAspectRatio() ); camUi.setCamera( &cam ); }
void PointCloudApp::draw() { gl::viewport( getWindowSize() ); gl::clear(); gl::setMatrices( mCamUi.getCamera() ); gl::enableAlphaBlending(); gl::enableDepthRead(); gl::enableDepthWrite(); if ( mSurfaceColor ) { if ( mTextureColor ) { mTextureColor->update( *mSurfaceColor ); } else { mTextureColor = gl::Texture::create( *mSurfaceColor ); } mTextureColor->bind( 0 ); } if ( mChannelDepth ) { if ( mTextureDepth ) { gl::ScopedTextureBind scopeTextureBind( mTextureDepth->getTarget(), mTextureDepth->getId() ); glTexSubImage2D( mTextureDepth->getTarget(), 0, 0, 0, mTextureDepth->getWidth(), mTextureDepth->getHeight(), GL_RED_INTEGER, GL_UNSIGNED_SHORT, mChannelDepth->getData() ); } else { mTextureDepth = gl::Texture::create( mChannelDepth->getWidth(), mChannelDepth->getHeight(), gl::Texture::Format().dataType( GL_UNSIGNED_SHORT ).internalFormat( GL_R16UI ) ); } mTextureDepth->bind( 1 ); } if ( mSurfaceDepthToCameraTable && !mTextureDepthToCameraTable ) { mTextureDepthToCameraTable = gl::Texture::create( *mSurfaceDepthToCameraTable ); mTextureDepthToCameraTable->bind( 2 ); } if ( mSurfaceDepthToColorTable ) { if ( mTextureDepthToColorTable ) { mTextureDepthToColorTable->update( *mSurfaceDepthToColorTable ); } else { mTextureDepthToColorTable = gl::Texture::create( *mSurfaceDepthToColorTable, gl::Texture::Format().dataType( GL_FLOAT ) ); } mTextureDepthToColorTable->bind( 3 ); } gl::ScopedGlslProg scopeGlsl( mGlslProg ); gl::setDefaultShaderVars(); mGlslProg->uniform( "uTextureColor", 0 ); mGlslProg->uniform( "uTextureDepth", 1 ); mGlslProg->uniform( "uTextureDepthToCameraTable", 2 ); mGlslProg->uniform( "uTextureDepthToColorTable", 3 ); gl::draw( mVboMesh ); if ( mTextureColor ) { mTextureColor->unbind(); } if ( mTextureDepth ) { mTextureDepth->unbind(); } if ( mTextureDepthToCameraTable ) { mTextureDepthToCameraTable->unbind(); } if ( mTextureDepthToColorTable ) { mTextureDepthToColorTable->unbind(); } mParams->draw(); }