void LookAroundYouApp::draw() { // clear out the window with black gl::clear( Color( 0, 0, 0 ) ); // set up the camera gl::pushMatrices(); gl::setMatrices( mMayaCam.getCamera() ); for(int i=0; i<mBoids.size(); i++) { mBoids[i]->draw(); } gl::drawCoordinateFrame( 6.0f ); gl::popMatrices(); // Draw the interface mParams.draw(); float pos = music->getPlayheadNorm(); Rectf bar(0, 0, app::getWindowWidth()*pos, 10); gl::drawSolidRect(bar); }
void PaintingBeingsApp::draw() { gl::clear(ColorAf::gray(0.6f)); gl::setViewport(getWindowBounds()); gl::setMatrices(_camera); glMultMatrixf(_arcball.getQuat()); if (_showWireFrame) gl::enableWireframe(); else gl::disableWireframe(); if (_launchAlgoGen) { if (!_showImageBeing) { _image.getTexture().enableAndBind(); gl::draw(_image.getTexture(), _rectangleTextutre); _image.getTexture().unbind(); gl::Texture textureAlgoGen = _algoGen.getBestImage(); textureAlgoGen.enableAndBind(); gl::draw(textureAlgoGen, _rectangleAlgoGen); textureAlgoGen.unbind(); } else { _imageBeing.draw(_algoGen.getBestImage()); } } _params.draw(); }
void AnotherSandboxProjectApp::draw() { gl::clear( Color( 0, 0, 0 ) ); glUseProgram(_drawingProgram); glBindVertexArray(_drawingVAO); glBindBuffer(GL_ARRAY_BUFFER, _drawingVBO); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_BUFFER, _gridTex); glBindSampler(0, 0); glProgramUniform2f(_drawingProgram, _drawingScreenSizeLoc, (GLfloat)getWindowWidth(), (GLfloat)getWindowHeight()); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); glUseProgram(0); vec2 cellRectSize = vec2((float)getWindowWidth() / (float)_DSPController->getGridSize().x, (float)getWindowHeight() / (float)_DSPController->getGridSize().x); ivec2 mouseCell = (ivec2)((vec2)getMousePos() / cellRectSize); vec2 mouseCellPoint = (vec2)mouseCell * cellRectSize; gl::color(1.0, 0.0, 0.0); gl::drawSolidRect(Rectf(mouseCellPoint, mouseCellPoint + cellRectSize)); _params.draw(); }
void ArmyDemoApp::draw() { gl::clear( Color::black() ); gl::setMatrices( mCamera ); gl::translate( 0, -5.0f, 0.0f ); gl::scale( vec3( 0.1f ) ); if ( mEnableWireframe ) gl::enableWireframe(); for(int i=0; i < ROW_LEN; ++i) { for(int j=0; j < ROW_LEN; ++j ) { gl::pushModelMatrix(); gl::translate(SPACING * (i - 0.5f * ROW_LEN), 0, SPACING * (j - 0.5f * ROW_LEN)); mSkeletalMesh->setPose( mTime + 2.0f*( i * j )/NUM_MONSTERS ); if( mDrawMesh ) { model::Renderer::draw( mSkeletalMesh ); } if( mDrawSkeleton) { model::Renderer::draw( mSkeletalMesh->getSkeleton() ); } gl::popModelMatrix(); } } if ( mEnableWireframe ) gl::disableWireframe(); mParams.draw(); }
void ColorTilesApp::draw() { gl::clear(Color(0, 0, 0)); gl::setMatrices(camera_); gl::rotate(sceneRotation_); std::for_each(tiles_.begin(), tiles_.end(), std::mem_fun(&Tile::draw)); params_.draw(); }
void TestbedApp::draw() { // clear out the window with black gl::clear( Color( 0, 0, 0 ) ); settings.hz = settingsHz; test->Step(&settings); // Update the state of the particle parameter. bool restartTest; const bool changed = particleParameter.Changed(&restartTest); B2_NOT_USED(changed); test->DrawTitle(entry->name); #if ! defined( CINDER_GL_ES ) mParams.draw(); #else gl::color( 0.6f, 0.6f, 0.7f ); gl::drawSolidRect( mLeftButton ); gl::drawSolidRect( mRightButton ); #endif if (testSelection != testIndex || restartTest) { fullscreenUI.Reset(); if (!restartTest) particleParameter.Reset(); testIndex = testSelection; delete test; entry = g_testEntries + testIndex; test = entry->createFcn(); viewZoom = test->GetDefaultViewZoom(); settings.viewCenter.Set(0.0f, 20.0f * viewZoom); resizeView( width, height ); } // print world step time stats every 600 frames static int s_printCount = 0; static b2Stat st; st.Record(settings.stepTimeOut); const int STAT_PRINT_INTERVAL = 600; if( settings.printStepTimeStats && st.GetCount() == STAT_PRINT_INTERVAL ) { console() << "World Step Time samples " << s_printCount*STAT_PRINT_INTERVAL << "-" << (s_printCount+1)*STAT_PRINT_INTERVAL-1 << ": " << st.GetMin() << "min " << st.GetMax() << "max " << st.GetMean() << "avg (ms)" << std::endl; s_printCount++; } }
void ocvWarpApp::draw() { gl::clear( Color( 1, 1, 1 ) ); gl::color( Color( 1, 1, 1 ) ); updateImage(); gl::draw( mTexture ); gl::color( Color( 1, 1, 0 ) ); gl::drawSolidCircle( mRotationCenter, 4.0f ); mParams.draw(); }
void f6_structure::draw() { // clear out the window with black gl::clear( Color( 0, 0, 0 ) ); if (mParamsVisible) mParams.draw(); if (mParticlesVisible) { for (int i = 0; i < pss.size(); i++) pss[i].draw(mMousePosition); } }
void SmilesApp::draw() { gl::enableAlphaBlending(); gl::clear( Color::black() ); gl::color(1.0f, 1.0f, 1.0f); // draw webcam capture if( !mCapture || !mSurface ) return; gl::draw( gl::Texture(mSurface) ); if(mGreyChannel){ gl::pushMatrices();{ gl::translate(mSmileRect.getUpperLeft()); gl::draw( gl::Texture(mGreyChannel) ); }gl::popMatrices(); } // draw rect that actually gets analysed: gl::color(ColorA(0.0f, 1.0f, 0.0f, 1.0f)); gl::drawStrokedRect(mSmileRect); gl::drawStrokedCircle(mSmileRect.getUpperLeft(), 10); gl::drawStrokedCircle(mSmileRect.getUpperRight(), 10); gl::drawStrokedCircle(mSmileRect.getLowerLeft(), 10); gl::drawStrokedCircle(mSmileRect.getLowerRight(), 10); //draw mSmileThreshold gl::pushMatrices();{ gl::color(ColorA(1.0f, 0.0f, 0.0f, 0.3f)); gl::drawSolidRect(Rectf( 0, (1-mSmileThreshold)*getWindowHeight(), getWindowWidth(), getWindowHeight() ) ); gl::drawStrokedRect( Rectf(0, 0, getWindowWidth(), getWindowHeight() ) ); }gl::popMatrices(); //draw faces if(!mFaces.empty()){ gl::pushMatrices();{ gl::translate(mSmileRect.getUpperLeft()); gl::color(1.0f, 1.0f, 1.0f); for(list<VisualObject *>::iterator it = mFaces.begin(); it != mFaces.end(); ++it) { mFace = static_cast<FaceObject*>(*it); gl::drawStrokedRect(Rectf(mFace->x, mFace->y, mFace->x+mFace->xSize, mFace->y+mFace->ySize )); } }gl::popMatrices(); } mParams.draw(); }
void Fluid2DBasicApp::draw() { // clear out the window with black gl::clear( Color( 0, 0, 0 ) ); Channel32f chan( mFluid2D.resX(), mFluid2D.resY(), mFluid2D.resX()*sizeof(float), 1, const_cast<float*>( mFluid2D.density().data() ) ); if( ! mTex ) { mTex = gl::Texture( chan ); } else { mTex.update( chan ); } gl::color( Color( 1, 1, 1 ) ); gl::draw( mTex, getWindowBounds() ); mParams.draw(); }
void PolygonBooleanApp::draw() { gl::clear( Color( 0.24f, 0.24f, 0.24f ) ); gl::color( ColorA( 0.25f, 0.5f, 1.0f, 0.15f ) ); gl::draw( *mPolyAMesh ); gl::color( ColorA( 0.25f, 1.0f, 0.5f, 0.15f ) ); gl::draw( *mPolyBMesh ); gl::lineWidth( 2.0f ); gl::color( ColorA( 1.0f, 0.5f, 0.25f, 1.0f ) ); for( size_t c = 0; c < mPolyResult.size(); ++c ) gl::draw( mPolyResult[c] ); mParams.draw(); }
void _TBOX_PREFIX_App::draw() { // clear out the window with black gl::clear( Color( 0, 0, 0 ) ); // set up the camera gl::pushMatrices(); gl::setMatrices( mMayaCam.getCamera() ); Vec3f size = 5.0f * Vec3f::one(); gl::drawColorCube( 0.5f * size, size ); gl::drawCoordinateFrame( 6.0f ); gl::popMatrices(); // Draw the interface mParams.draw(); }
void ArtkpApp::draw() { gl::clear( Color::black() ); gl::disableDepthRead(); gl::disableDepthWrite(); // draws camera image gl::setViewport( getWindowBounds() ); gl::setMatricesWindow( getWindowSize() ); gl::color( Color::white() ); Area outputArea = Area::proportionalFit( Area( 0, 0, CAPTURE_WIDTH, CAPTURE_HEIGHT ), getWindowBounds(), true, true ); if ( mCaptTexture ) gl::draw( mCaptTexture, outputArea ); // places a cube on each detected marker gl::enableDepthRead(); gl::enableDepthWrite(); gl::setViewport( outputArea ); // sets the projection matrix mArTracker.setProjection(); // scales the pattern according th the pattern width Vec3d patternScale = Vec3d::one() * mArTracker.getOptions().getPatternWidth(); for ( int i = 0; i < mArTracker.getNumMarkers(); i++ ) { // id -1 means unknown marker, false positive if ( mArTracker.getMarkerId( i ) == -1 ) continue; // sets the modelview matrix of the i'th marker mArTracker.setModelView( i ); gl::scale( patternScale ); gl::translate( Vec3f( 0.f, .0f, .5f ) ); // places the cube on the marker instead of the center gl::drawColorCube( Vec3f::zero(), Vec3f::one() ); } mParams.draw(); }
void TriangulationApp::draw() { if( mOldPrecision != mPrecision ) recalcMesh(); gl::clear(); gl::pushModelView(); gl::translate( getWindowCenter() * Vec2f( 0.8f, 1.2f ) ); gl::scale( Vec3f( mZoom, mZoom, mZoom ) ); gl::color( Color( 0.8f, 0.4f, 0.0f ) ); gl::draw( mVboMesh ); if( mDrawWireframe ) { gl::enableWireframe(); gl::color( Color::white() ); gl::draw( mVboMesh ); gl::disableWireframe(); } gl::popModelView(); mParams.draw(); }
void KaleidoscopeApp::draw() { gl::clear(); gl::setViewport( getWindowBounds() ); gl::setMatricesWindow( getWindowSize() ); if ( mShader ) { mShader.bind(); mShader.uniform( "center", mCenter ); mShader.uniform( "numReflectionLines", mNumReflectionLines ); mShader.uniform( "rotation", mRotation ); mShader.uniform( "txt", 0 ); } if ( mTexture ) gl::draw( mTexture, getWindowBounds() ); if ( mShader ) mShader.unbind(); mParams.draw(); }
void DelaunayMeshMaker::draw() { gl::clear(); gl::pushMatrices(); gl::pushModelView(); gl::color( ColorA::white() ); if( mMesh.getNumTriangles() > 0 ){ if( mApplyPhongShading ) mPhongShader.bind(); gl::enableDepthRead(); gl::enableDepthWrite(); gl::disableAlphaBlending(); if( mDrawWireframe ) gl::enableWireframe(); gl::draw( mVboMesh ); if( mDrawWireframe ) gl::disableWireframe(); if( mApplyPhongShading ) mPhongShader.unbind(); } if( mAlpha > 0.0f ){ gl::disableDepthRead(); gl::disableDepthWrite(); gl::enableAlphaBlending(); gl::color( ColorA( 1,1,1, mAlpha ) ); gl::draw( mSurface ); } gl::popModelView(); gl::popMatrices(); if( mTesselator->isRunning() ){ gl::disableDepthRead(); gl::disableDepthWrite(); gl::enableAlphaBlending(); gl::color( ColorA(0.0f, 0.0f, 0.0f, 0.5f ) ); gl::drawSolidRect( Rectf( 0, 0, app::getWindowWidth(), app::getWindowHeight() ) ); gl::pushModelView(); gl::translate( app::getWindowSize()/2 ); double time = getElapsedSeconds(); double fraction = time - (int) time; int numFractions = 12; for(int i=0;i<numFractions;++i) { float a = (float) (fraction + i * (1.0f / (float)numFractions)); a -= (int) a; gl::pushModelView(); gl::rotate( i * ( -360.0f/(float)numFractions ) ); gl::color( ColorA(1,1,1,1-a) ); gl::drawSolidRect( Rectf(-6.0f, -44.0f, +6.0f, -31.0f) ); gl::popModelView(); } gl::popModelView(); } mParams.draw(); }
void KinectEcard::draw() { gl::clear( Color::black() ); gl::color( Color::white() ); // gl::setViewport( app::getWindowBounds() ); // draw FBO's gl::pushMatrices(); { // draw video stream and info string gl::pushMatrices(); mVideoFbo.getTexture().setFlipped(); gl::draw( mVideoFbo.getTexture() ); gl::pushMatrices(); gl::enableAlphaBlending(); gl::drawString( "Video stream ", Vec2f( 20, 10 ), ColorA::black(), Font( "Arial", 40 ) ); gl::disableAlphaBlending(); gl::popMatrices(); gl::popMatrices(); gl::pushMatrices(); gl::translate( mVideoFbo.getWidth(), 0 ); mDepthFbo.getTexture().setFlipped(); gl::draw( mDepthFbo.getTexture() ); gl::pushMatrices(); gl::enableAlphaBlending(); gl::drawString( "Depth stream ", Vec2f( 20, 10 ), ColorA::black(), Font( "Arial", 40 ) ); gl::disableAlphaBlending(); gl::popMatrices(); gl::popMatrices(); gl::popMatrices(); gl::pushMatrices(); gl::translate( 0, mVideoFbo.getHeight() ); gl::draw( mSubstractedVideoFbo.getTexture() ); gl::pushMatrices(); gl::enableAlphaBlending(); gl::drawString( "Result ", Vec2f( 20, 10 ), ColorA::black(), Font( "Arial", 40 ) ); gl::disableAlphaBlending(); gl::popMatrices(); gl::popMatrices(); gl::pushMatrices(); gl::translate( mVideoFbo.getWidth(), mVideoFbo.getHeight() ); mStoredDepthFbo.getTexture().setFlipped(); gl::draw( mStoredDepthFbo.getTexture() ); gl::pushMatrices(); gl::enableAlphaBlending(); gl::drawString( "Stored depth buffer ", Vec2f( 20, 10 ), ColorA::black(), Font( "Arial", 40 ) ); gl::disableAlphaBlending(); gl::popMatrices(); gl::popMatrices(); if( mDrawDepthCorrectionMap ){ gl::pushMatrices(); { gl::scale( 0.25f, 0.25f ); gl::draw( mCorrectionMap ); } gl::popMatrices(); } } gl::popMatrices(); // draw bounderies for niceness gl::pushMatrices(); gl::color( ColorA::black() ); gl::drawLine( Vec3i( 0, mVideoFbo.getHeight(), 0 ), Vec3i( mVideoFbo.getWidth()*2, mVideoFbo.getHeight(), 0 ) ); gl::drawLine( Vec3i( mVideoFbo.getWidth(), 0, 0 ), Vec3i( mVideoFbo.getWidth(), mVideoFbo.getHeight()*2, 0 ) ); gl::popMatrices(); mParams.draw(); }
void draw() { // сюда должно разместить логику перересовки приложения в связи с наступлением нового кадра. вызывется каждый кадр gl::clear( Color::black() ); // стееть все что нарисованно на сцене gl::drawCube(objectPosition , Vec3f( 10.0f, 100.0f, 2.0f ) ); // нарисовать параленнипипед cameraParams.draw(); // нарисовать окно параметров }
void ForelleVisualAppApp::draw() { // clear out the window with black gl::clear( Color(0, 0,0 ) ); // draw our logo gl::draw(mLogo, Vec2i(0, getWindowHeight()-mLogo.getHeight() ) ); //update our Client // stick together with draw; client.update(); //gl::color( Colorf(0.0f, 0.0f, 0.0f) ); //draw the Image from the client gl::draw( *client.getTexture(), Rectf(pos.x,pos.y,pos.x+(60*scale),pos.y+(60*scale))); if (drawGrid) { // draw Pixel grid gl::color( Colorf(1.0f, 1.0f, 1.0f) ); gl::pushMatrices(); gl::translate(pos); for(float i=0;i<=60*scale;i+=scale) { gl::drawLine( Vec2f(i, 0), Vec2f(i, 60*scale) ); gl::drawLine( Vec2f(0, i), Vec2f(60*scale, i) ); } gl::popMatrices(); } if(updateCluster) controller.updateAndDrawClusters(clusters, *client.getSurface(), pos, scale); if(readPixels) controller.getData(clusters,data1,data2,data3,data4); if(bAllOn){ for (int i=0; i < Const::MAX_DMX_CHANNELS ; i++) { data1[i]= 255; data2[i]= 255; data3[i]= 255; data4[i]= 255; } }else if(bAllOff){ for (int i=0; i < Const::MAX_DMX_CHANNELS ; i++) { data1[i]= 0; data2[i]= 0; data3[i]= 0; data4[i]= 0; } } if(selectedClusterOn && !clusters.empty() ){ for (int i=0; i < Const::MAX_DMX_CHANNELS ; i++) { data1[i]= 0; data2[i]= 0; data3[i]= 0; data4[i]= 0; int universe = *(*selectedCluster)->getUniverse(); if (universe == 0) { (*selectedCluster)->getChannelData(data1); }else if (universe == 1) { (*selectedCluster)->getChannelData(data2); }else if (universe == 2) { (*selectedCluster)->getChannelData(data3); }else if (universe == 3) { (*selectedCluster)->getChannelData(data4); } } } if(sendData){ node.sendDataAtPort(data1, 0); node.sendDataAtPort(data2, 1); node.sendDataAtPort(data3, 2); node.sendDataAtPort(data4, 3); } // Draw the interface clusterBar.draw(); menueBar.draw(); }
void ProceduralAnimApp::draw() { // clear out the window with black gl::clear( Color( 0.4f, 0.5f, 0.6f ) ); gl::setMatrices( mMayaCam.getCamera() ); gl::enableDepthRead(); gl::Light light( gl::Light::DIRECTIONAL, 0 ); light.setAmbient( Color::white() ); light.setDiffuse( Color::white() ); light.setSpecular( Color::white() ); light.lookAt( mLightPos, Vec3f::zero() ); light.update( mMayaCam.getCamera() ); light.enable(); gl::pushMatrices(); float e = (float)getElapsedSeconds(); gl::translate( math<float>::sin( 1.3f * e ), math<float>::cos( 2.7f * e ) ); gl::enable( GL_LIGHTING ); gl::enable( GL_NORMALIZE ); if ( mEnableWireframe ) gl::enableWireframe(); if( mDrawMesh ) { SkinningRenderer::draw( mSkinnedVboBird ); } if ( mEnableWireframe ) gl::disableWireframe(); gl::disable( GL_LIGHTING ); gl::disable( GL_NORMALIZE ); if( mDrawSkeleton) { SkinningRenderer::draw( mSkinnedVboBird->getSkeleton() ); } if( mDrawLabels ) { SkinningRenderer::drawLabels( mSkinnedVboBird->getSkeleton(), mMayaCam.getCamera() ); } gl::popMatrices(); Vec3f mRight, mUp; mMayaCam.getCamera().getBillboardVectors(&mRight, &mUp); // gl::disableDepthRead(); gl::disableDepthWrite(); gl::enableAlphaBlending(); dustParticleTex->enableAndBind(); mDustShader->bind(); mDustShader->uniform( "tex", 0 ); for( const auto& d : mDust ) { mDustShader->uniform( "transparency", 1.0f - math<float>::abs(d.z)/(SCENE_SIZE/2.0f) ); gl::drawBillboard(d, Vec2f(60.f, 60.f), 0.0f, mRight, mUp); } mDustShader->unbind(); dustParticleTex->unbind(); mParams.draw(); }
void UserApp::draw() { gl::setViewport( getWindowBounds() ); gl::clear( Color::black() ); gl::setMatricesWindow( Vec2i(getWindowWidth(), getWindowHeight()) ); gl::color( Colorf::black() ); // if ( mShapeDetection.mSurfaceSubtract ) { // if ( mTexture ) { // mTexture->update( Channel32f( mShapeDetection.mSurfaceSubtract ) ); // } else { // mTexture = gl::Texture::create( Channel32f( mShapeDetection.mSurfaceSubtract ) ); // } // gl::draw( mTexture, mTexture->getBounds(), getWindowBounds() ); // } gl::setMatrices( mCamera ); gl::color( Colorf( 1.0f, 0.0f, 0.0f ) ); for ( std::vector<nite::UserData>::const_iterator iter = mUsers.begin(); iter != mUsers.end(); ++iter ) { const nite::Skeleton& skeleton = iter->getSkeleton(); if ( skeleton.getState() == nite::SKELETON_TRACKED ) { // this draws the first 15 points (so no joints get drawn twice) for ( int i=0; i<15; i++ ) { gl::enableAlphaBlending(); glPointSize(5.0f); gl::disableAlphaBlending(); gl::color( Color(0.5f, 0.5f, 0.5f) ); gl::begin( GL_POINTS ); const nite::SkeletonJoint& joint0 = skeleton.getJoint( mBones[i].mJointA ); if (joint0.getType() == nite::JOINT_LEFT_KNEE) { mLeftKnee = joint0.getPosition(); } else if ( joint0.getType() == nite::JOINT_RIGHT_KNEE ) { mRightKnee = joint0.getPosition(); } else if ( joint0.getType() == nite::JOINT_TORSO ) { mTorso = joint0.getPosition(); } const nite::SkeletonJoint& joint1 = skeleton.getJoint( mBones[i].mJointB ); Vec3f v0 = OpenNI::toVec3f( joint0.getPosition() ); // Vec3f v1 = OpenNI::toVec3f( joint1.getPosition() ); v0.x = -v0.x; // v1.x = -v1.x; gl::vertex( v0 ); for ( int j=0; j<mShowJoints.size(); j++ ){ if ( mShowJoints[i] && j == mBones[i].mJointA) { mTrails[j].arrive( v0 ); mTrails[j].updateTrail(); // mJointTrail.push_back(Vec2f( v0.x, v0.y ) ); // if ( mJointTrail.size() > 200 ) { // mJointTrail.pop_front(); // } // cout << "size " << mTrails.mTrail.size() << endl; } } // gl::vertex( v1 ); gl::end(); } // draw negative space around the dancer if (mShowNegativeSpace) { gl::begin( GL_POLYGON ); gl::enableAlphaBlending(); gl::color( ColorA(1.0f, 0.8f, 0.0f, 0.5f) ); gl::lineWidth(1.0f); gl::disableAlphaBlending(); for ( int i = 20; i < mBones.size(); i++ ) { const nite::SkeletonJoint& joint0 = skeleton.getJoint( mBones[i].mJointA ); const nite::SkeletonJoint& joint1 = skeleton.getJoint( mBones[i].mJointB ); Vec3f v0 = OpenNI::toVec3f( joint0.getPosition() ); Vec3f v1 = OpenNI::toVec3f( joint1.getPosition() ); v0.x = -v0.x; v1.x = -v1.x; // PRINT DISTANCES // Vec3f distPoint = v0 - v1; // float dist = sqrt( distPoint.x * distPoint.x + distPoint.y * distPoint.y ); // cout << "the distance between " << mBones[i].mJointA << " and " << mBones[i].mJointB << " is " << dist << endl; gl::vertex( v0 ); gl::vertex( v1 ); } gl::end(); } // draw distance lines if (mShowDistanceLines && !mShowNegativeSpace) { gl::begin( GL_LINES ); gl::enableAlphaBlending(); gl::color( ColorA(1.0f, 1.0f, 1.0f, 0.3f) ); gl::lineWidth(1.0f); gl::disableAlphaBlending(); for ( int i = 15; i <= 19; i++ ) { const nite::SkeletonJoint& joint0 = skeleton.getJoint( mBones[i].mJointA ); const nite::SkeletonJoint& joint1 = skeleton.getJoint( mBones[i].mJointB ); Vec3f v0 = OpenNI::toVec3f( joint0.getPosition() ); Vec3f v1 = OpenNI::toVec3f( joint1.getPosition() ); v0.x = -v0.x; v1.x = -v1.x; // PRINT DISTANCES Vec3f distPoint = v0 - v1; float dist = sqrt( distPoint.x * distPoint.x + distPoint.y * distPoint.y ); cout << "the distance between " << mBones[i].mJointA << " and " << mBones[i].mJointB << " is " << dist << endl; gl::vertex( v0 ); gl::vertex( v1 ); } gl::end(); } } } gl::setMatrices( mCamera ); glLineWidth(10.0f); int counter = 0; for( TrailPoint trail: mTrails ) { gl::color( mColors[counter] ); glBegin( GL_LINE_STRIP ); for( Vec3f v: trail.mTrail ) { gl::vertex( v ); } glEnd(); counter += 1; } if ( mCounter == 250 ) { mShapePoints.clear(); mShapePoints = mTrails[0].mTrail; mCounter = 0; mJointCounter++; if (mJointCounter == 15) { mJointCounter = 0; } } gl::pushModelView(); gl::translate( 100, 100 ); gl::scale(0.25f, 0.25f); gl::color(mColors[mJointCounter]); glBegin(GL_LINE_STRIP); for (Vec3f v: mShapePoints) { gl::vertex(v); } glEnd(); gl::popModelView(); // show if dancer is on or off balance if ( mUseBalance ) { mShapeDetection.onBalance( mLeftKnee, mRightKnee, mTorso ); } // draw contour points mShapeDetection.draw( mUseBalance, mShowNegativeSpace ); // draw gui params mParams.draw(); gl::color( Color::white() ); gl::drawSolidRect( Rectf( 0, getWindowHeight(), getWindowWidth(), 500 ) ); mCounter++; }
void SpriteSheetGeneratorApp::draw() { mParams.draw(); }