void CameraLensShiftTestApp::draw() { gl::clear(); gl::enableDepthRead(); gl::enableDepthWrite(); // draw the overview of the scene in the left half of the window glPushAttrib( GL_VIEWPORT_BIT ); gl::setViewport( Area( getWindowWidth() * 0.0f, 0, getWindowWidth() * 0.5f, getWindowHeight() ) ); gl::pushMatrices(); gl::setMatrices( mOverview.getCamera() ); render(); gl::color( Color(0, 1, 1) ); gl::drawFrustum( mCamera ); gl::popMatrices(); glPopAttrib(); // draw what the camera sees in the right half of the window glPushAttrib( GL_VIEWPORT_BIT ); gl::setViewport( Area( getWindowWidth() * 0.5f, 0, getWindowWidth() * 1.0f, getWindowHeight() ) ); gl::pushMatrices(); gl::setMatrices( mCamera ); render(); gl::popMatrices(); glPopAttrib(); // gl::disableDepthWrite(); gl::disableDepthRead(); // draw separator gl::color( Color(0.25f, 0.25f, 0.25f) ); gl::drawLine( Vec2f( getWindowWidth() * 0.5f, 0.0f ), Vec2f( getWindowWidth() * 0.5f, getWindowHeight() ) ); // draw info gl::enableAlphaBlending(); gl::drawString( (boost::format("Lens Shift X: %02.2f\nLens Shift Y: %02.2f\n\nUse cursor keys to adjust lens shift,\nuse mouse to control overview camera") % mCamera.getLensShiftHorizontal() % mCamera.getLensShiftVertical() ).str(), Vec2f( 10, 10 ), Color::white(), mFont ); gl::drawString( "Overview of the scene", Vec2f( 10, getWindowHeight() - 28 ), Color::white(), mFont ); gl::drawString( "View from the camera", Vec2f( 0.5f * getWindowWidth() + 10, getWindowHeight() - 28 ), Color::white(), mFont ); gl::disableAlphaBlending(); }