// this draws with the sphere and axes to help undertand how arcball works void ArcballDemoApp::drawVerbose() { // draw the cube gl::pushModelView(); gl::translate( getWindowCenter() ); gl::scale( Vec3f( 200.0f, 200.0f, 200.0f ) ); gl::rotate( mArcball.getQuat() ); gl::drawColorCube( Vec3f::zero(), Vec3f( 1, 1, 1 ) ); gl::popModelView(); // draw the back faces of the sphere gl::pushModelView(); glColor4f( 0.0, 0.0, 0.0, 0.3f ); gl::disableDepthWrite(); gl::translate( getWindowCenter() ); glCullFace( GL_FRONT ); gl::drawSphere( Vec3f::zero(), mArcball.getRadius(), 50 ); gl::popModelView(); gl::enableDepthWrite(); glCullFace( GL_BACK ); // draw the axes gl::pushModelView(); gl::translate( getWindowCenter() ); // start glColor4f( 1.0, 1.0, 0.0f, 1.0f ); gl::drawVector( Vec3f::zero(), mArcball.mouseOnSphere( mInitialMouseDown ) * mArcball.getRadius(), 10, 5 ); // end glColor4f( 0.0, 1.0, 0.0f, 1.0f ); gl::drawVector( Vec3f::zero(), mArcball.mouseOnSphere( mCurrentMouseDown ) * mArcball.getRadius(), 10, 5 ); // constraint if( mUseConstraintAxis ) { glColor4f( 0.0, 0.7f, 1.0f, 1.0f ); gl::drawVector( mConstraintAxis * -mArcball.getRadius() * 1.5, mConstraintAxis * mArcball.getRadius() * 1.5, 10, 5 ); } gl::popModelView(); // draw the front faces of the sphere gl::pushModelView(); glColor4f( 0.0, 0.0, 0.0, 0.3f ); gl::translate( getWindowCenter() ); gl::drawSphere( Vec3f::zero(), mArcball.getRadius(), 50 ); gl::popModelView(); }