void StarsApp::draw() { gl::clear( Color::black() ); gl::pushMatrices(); gl::setMatrices( mCamera.getCamera() ); { // draw background mBackground.draw(); // draw grid if(mIsGridVisible) mGrid.draw(); // draw stars mStars.draw(); } gl::popMatrices(); // draw user interface mUserInterface.draw(); // fade in at start of application gl::enableAlphaBlending(); double t = math<double>::clamp( mTimer.getSeconds() / 3.0, 0.0, 1.0 ); float a = ci::lerp<float>(1.0f, 0.0f, (float) t); if( a > 0.0f ) { gl::color( ColorA(0,0,0,a) ); gl::drawSolidRect( getWindowBounds() ); } gl::disableAlphaBlending(); }
void StarsApp::render() { // draw background mBackground.draw(); // draw grid if(mIsGridVisible) mGrid.draw(); // draw stars mStars.draw(); // draw constellations if(mIsConstellationsVisible) mConstellations.draw(); // draw labels (for now, labels don't behave well in cylindrical view) if(mIsLabelsVisible && !mIsCylindrical) { mLabels.draw(); if(mIsConstellationsVisible) mConstellationLabels.draw(); } }
void StarsApp::draw() { float w = 0.5f * getWindowWidth(); float h = 1.0f * getWindowHeight(); gl::clear( Color::black() ); if(mIsStereoscopic) { glPushAttrib( GL_VIEWPORT_BIT ); // render left eye gl::setViewport( Area(0, 0, w, h) ); mCamera.enableStereoLeft(); gl::pushMatrices(); gl::setMatrices( mCamera.getCamera() ); { // draw background mBackground.draw(); // draw grid if(mIsGridVisible) mGrid.draw(); // draw stars mStars.draw(); // draw constellations if(mIsConstellationsVisible) { mConstellations.draw(); mConstellationLabels.draw(); } // draw labels if(mIsLabelsVisible) mLabels.draw(); } gl::popMatrices(); // draw user interface mUserInterface.draw(); // render right eye gl::setViewport( Area(w, 0, w * 2.0f, h) ); mCamera.enableStereoRight(); gl::pushMatrices(); gl::setMatrices( mCamera.getCamera() ); { // draw background mBackground.draw(); // draw grid if(mIsGridVisible) mGrid.draw(); // draw stars mStars.draw(); // draw constellations if(mIsConstellationsVisible) { mConstellations.draw(); mConstellationLabels.draw(); } // draw labels if(mIsLabelsVisible) mLabels.draw(); } gl::popMatrices(); // draw user interface mUserInterface.draw(); glPopAttrib(); } else { mCamera.disableStereo(); gl::pushMatrices(); gl::setMatrices( mCamera.getCamera() ); { // draw background mBackground.draw(); // draw grid if(mIsGridVisible) mGrid.draw(); // draw stars mStars.draw(); // draw constellations if(mIsConstellationsVisible) { mConstellations.draw(); mConstellationLabels.draw(); } // draw labels if(mIsLabelsVisible) mLabels.draw(); } gl::popMatrices(); // draw user interface mUserInterface.draw(); } // fade in at start of application gl::enableAlphaBlending(); double t = math<double>::clamp( mTimer.getSeconds() / 3.0, 0.0, 1.0 ); float a = ci::lerp<float>(1.0f, 0.0f, (float) t); if( a > 0.0f ) { gl::color( ColorA(0,0,0,a) ); gl::drawSolidRect( getWindowBounds() ); } gl::disableAlphaBlending(); }