当前位置: 首页>>代码示例>>C++>>正文


C++ Fbo::getAspectRatio方法代码示例

本文整理汇总了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();
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:29,代码来源:FBOMultipleTargetsApp.cpp

示例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 ) );
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:32,代码来源:FBOBasicApp.cpp


注:本文中的gl::Fbo::getAspectRatio方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。