| 71 | } |
| 72 | |
| 73 | void CameraLensShiftTestApp::draw() |
| 74 | { |
| 75 | gl::clear(); |
| 76 | |
| 77 | gl::enableDepthRead(); |
| 78 | gl::enableDepthWrite(); |
| 79 | |
| 80 | // draw the overview of the scene in the left half of the window |
| 81 | gl::pushViewport(); |
| 82 | gl::viewport( ivec2(0, 0), ivec2(getWindowWidth() / 2, getWindowHeight()) ); |
| 83 | |
| 84 | gl::pushMatrices(); |
| 85 | gl::setMatrices( mOverview.getCamera() ); |
| 86 | |
| 87 | render(); |
| 88 | |
| 89 | gl::color( Color(0, 1, 1) ); |
| 90 | gl::drawFrustum( mCamera ); |
| 91 | |
| 92 | gl::popMatrices(); |
| 93 | |
| 94 | gl::popViewport(); |
| 95 | |
| 96 | // draw what the camera sees in the right half of the window |
| 97 | gl::pushViewport(); |
| 98 | gl::viewport( ivec2(getWindowWidth() / 2, 0), ivec2(getWindowWidth() / 2, getWindowHeight()) ); |
| 99 | |
| 100 | gl::pushMatrices(); |
| 101 | gl::setMatrices( mCamera ); |
| 102 | |
| 103 | render(); |
| 104 | |
| 105 | gl::popMatrices(); |
| 106 | |
| 107 | gl::popViewport(); |
| 108 | |
| 109 | // |
| 110 | gl::disableDepthWrite(); |
| 111 | gl::disableDepthRead(); |
| 112 | |
| 113 | // draw separator |
| 114 | gl::color( Color(0.25f, 0.25f, 0.25f) ); |
| 115 | gl::drawLine( vec2( getWindowWidth() * 0.5f, 0.0f ), vec2( getWindowWidth() * 0.5f, getWindowHeight() ) ); |
| 116 | |
| 117 | // draw info |
| 118 | gl::enableAlphaBlending(); |
| 119 | gl::drawString( |
| 120 | (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") |
| 121 | % mCamera.getLensShiftHorizontal() % mCamera.getLensShiftVertical() ).str(), |
| 122 | vec2( 10, 10 ), Color::white(), mFont ); |
| 123 | gl::drawString( "Overview of the scene", |
| 124 | vec2( 10, getWindowHeight() - 28 ), Color::white(), mFont ); |
| 125 | gl::drawString( "View from the camera", |
| 126 | vec2( 0.5f * getWindowWidth() + 10, getWindowHeight() - 28 ), Color::white(), mFont ); |
| 127 | gl::disableAlphaBlending(); |
| 128 | } |
| 129 | |
| 130 | void CameraLensShiftTestApp::mouseDown( MouseEvent event ) |
nothing calls this directly
no test coverage detected