本文整理汇总了C++中gl::Fbo::getAspectRatio方法的典型用法代码示例。如果您正苦于以下问题:C++ Fbo::getAspectRatio方法的具体用法?C++ Fbo::getAspectRatio怎么用?C++ Fbo::getAspectRatio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gl::Fbo
的用法示例。
在下文中一共展示了Fbo::getAspectRatio方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderSceneToFbo
// Render the torus into the FBO
void FBOMultipleTargetsApp::renderSceneToFbo()
{
// bind the framebuffer - now everything we draw will go there
mFbo.bindFramebuffer();
// setup the viewport to match the dimensions of the FBO
gl::setViewport( mFbo.getBounds() );
// setup our camera to render the torus scene
CameraPersp cam( mFbo.getWidth(), mFbo.getHeight(), 60.0f );
cam.setPerspective( 60, mFbo.getAspectRatio(), 1, 1000 );
cam.lookAt( Vec3f( 2.8f, 1.8f, -2.8f ), Vec3f::zero() );
gl::setMatrices( cam );
// set the modelview matrix to reflect our current rotation
gl::multModelView( mTorusRotation );
// clear out both of the attachments of the FBO with black
gl::clear();
// render the torus with our multiple-output shader
mShaderMultipleOuts.bind();
gl::drawTorus( 1.4f, 0.3f, 32, 64 );
mShaderMultipleOuts.unbind();
// unbind the framebuffer, so that drawing goes to the screen again
mFbo.unbindFramebuffer();
}
示例2: renderSceneToFbo
// Render the torus into the FBO
void FBOBasicApp::renderSceneToFbo()
{
// this will restore the old framebuffer binding when we leave this function
// on non-OpenGL ES platforms, you can just call mFbo.unbindFramebuffer() at the end of the function
// but this will restore the "screen" FBO on OpenGL ES, and does the right thing on both platforms
gl::SaveFramebufferBinding bindingSaver;
// bind the framebuffer - now everything we draw will go there
mFbo.bindFramebuffer();
// setup the viewport to match the dimensions of the FBO
gl::setViewport( mFbo.getBounds() );
// setup our camera to render the torus scene
CameraPersp cam( mFbo.getWidth(), mFbo.getHeight(), 60.0f );
cam.setPerspective( 60, mFbo.getAspectRatio(), 1, 1000 );
cam.lookAt( Vec3f( 2.8f, 1.8f, -2.8f ), Vec3f::zero() );
gl::setMatrices( cam );
// set the modelview matrix to reflect our current rotation
gl::multModelView( mTorusRotation );
// clear out the FBO with blue
gl::clear( Color( 0.25, 0.5f, 1.0f ) );
// render an orange torus, with no textures
glDisable( GL_TEXTURE_2D );
gl::color( Color( 1.0f, 0.5f, 0.25f ) );
gl::drawTorus( 1.4f, 0.3f, 32, 64 );
// gl::drawColorCube( Vec3f::zero(), Vec3f( 2.2f, 2.2f, 2.2f ) );
}