void ArcballTestApp::draw() { CameraPersp &cam = ( mUsingCameraUi ) ? mDebugCam : mCam; gl::clear( Color( 0, 0.0f, 0.15f ) ); gl::setMatrices( cam ); // draw the earth gl::enableDepthRead(); gl::enableDepthWrite(); gl::translate( mEarthSphere.getCenter() ); gl::rotate( mArcball.getQuat() ); mEarthTex->bind(); mEarth->draw(); // draw constraint axis if( mArcball.isUsingConstraint() ) { gl::setMatrices( cam ); gl::color( 1, 1, 0 ); gl::translate( mEarthSphere.getCenter() ); gl::rotate( glm::rotation( vec3( 0, 1, 0 ), mArcball.getConstraintAxis() ) ); mConstraintAxis->draw(); } gl::disableDepthRead(); // draw from vector marker gl::setMatrices( cam ); gl::color( 0, 1, 0.25f ); gl::translate( mEarthSphere.getCenter() + mArcball.getFromVector() * mEarthSphere.getRadius() ); mMarker->draw(); // draw to vector marker gl::setMatrices( cam ); gl::color( 1, 0.5f, 0.25f ); gl::translate( mEarthSphere.getCenter() + mArcball.getToVector() * mEarthSphere.getRadius() ); mMarker->draw(); // draw the elliptical axes gl::setMatricesWindow( getWindowSize() ); gl::color( 1, 0, 0 ); vec2 center, axisA, axisB; mCam.calcScreenProjection( mEarthSphere, getWindowSize(), ¢er, &axisA, &axisB ); gl::drawLine( center - axisA, center + axisA ); gl::drawLine( center - axisB, center + axisB ); }