Render the color cube into the FBO
| 36 | |
| 37 | // Render the color cube into the FBO |
| 38 | void FboBasicApp::renderSceneToFbo() |
| 39 | { |
| 40 | // this will restore the old framebuffer binding when we leave this function |
| 41 | // on non-OpenGL ES platforms, you can just call mFbo->unbindFramebuffer() at the end of the function |
| 42 | // but this will restore the "screen" FBO on OpenGL ES, and does the right thing on both platforms |
| 43 | gl::ScopedFramebuffer fbScp( mFbo ); |
| 44 | // clear out the FBO with blue |
| 45 | gl::clear( Color( 0.25, 0.5f, 1.0f ) ); |
| 46 | |
| 47 | // setup the viewport to match the dimensions of the FBO |
| 48 | gl::ScopedViewport scpVp( ivec2( 0 ), mFbo->getSize() ); |
| 49 | |
| 50 | // setup our camera to render the torus scene |
| 51 | CameraPersp cam( mFbo->getWidth(), mFbo->getHeight(), 60.0f ); |
| 52 | cam.setPerspective( 60, mFbo->getAspectRatio(), 1, 1000 ); |
| 53 | cam.lookAt( vec3( 2.8f, 1.8f, -2.8f ), vec3( 0 )); |
| 54 | gl::setMatrices( cam ); |
| 55 | |
| 56 | // set the modelview matrix to reflect our current rotation |
| 57 | gl::setModelMatrix( mRotation ); |
| 58 | |
| 59 | // render the color cube |
| 60 | gl::ScopedGlslProg shaderScp( gl::getStockShader( gl::ShaderDef().color() ) ); |
| 61 | gl::color( Color( 1.0f, 0.5f, 0.25f ) ); |
| 62 | gl::drawColorCube( vec3( 0 ), vec3( 2.2f ) ); |
| 63 | gl::color( Color::white() ); |
| 64 | } |
| 65 | |
| 66 | void FboBasicApp::update() |
| 67 | { |
nothing calls this directly
no test coverage detected