• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ gl::Fbo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中gl::Fbo的典型用法代码示例。如果您正苦于以下问题:C++ Fbo类的具体用法?C++ Fbo怎么用?C++ Fbo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Fbo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: draw

void MemExploreApp::draw()
{
  mTexture = gl::Texture(mDataPointer, GL_RGBA, mVolumeDim * mTilesDim, mVolumeDim * mTilesDim);
  mTexture.setWrap(GL_REPEAT, GL_REPEAT);
  mTexture.setMinFilter(GL_NEAREST);
  mTexture.setMagFilter(GL_NEAREST);
  
  float frustum[6];
  mCamera.getFrustum(&frustum[0], &frustum[1], &frustum[2], &frustum[3], &frustum[4], &frustum[5]);

  mFbo.bindFramebuffer();
  gl::setMatricesWindow(mFbo.getSize(), false);

  mProgram.bind();
  mProgram.uniform("uTexture", 0);
  mProgram.uniform("uVolumeDim", mVolumeDim);
  mProgram.uniform("uTilesDim", mTilesDim);
  mProgram.uniform("uTime", (float)getElapsedSeconds());
  mProgram.uniform("uEyePoint", mCamera.getEyePoint());
  mProgram.uniform("uXAxis", mCamera.getOrientation() * Vec3f::xAxis());
  mProgram.uniform("uYAxis", mCamera.getOrientation() * Vec3f::yAxis());
  mProgram.uniform("uViewDistance", mCamera.getAspectRatio() / abs(frustum[2] - frustum[0]) * mCamera.getNearClip());
  mProgram.uniform("uNegViewDir", -mCamera.getViewDirection().normalized());
  mProgram.uniform("uAspectRatio", mCamera.getAspectRatio());
  mTexture.enableAndBind();
  gl::drawSolidRect(mFbo.getBounds());
  mTexture.unbind();
  mProgram.unbind();
  
  mFbo.unbindFramebuffer();
  
  gl::setMatricesWindow(getWindowSize());
  gl::draw(mFbo.getTexture(), getWindowBounds());
}
开发者ID:imclab,项目名称:memdescent,代码行数:34,代码来源:MemExploreApp.cpp


示例2: setFboVelocities

void RepulsionApp::setFboVelocities( gl::Fbo &fbo )
{
	Surface32f vel( fbo.getTexture() );
	Surface32f::Iter it = vel.getIter();
	while( it.line() ){
		while( it.pixel() ){
			Vec3f r = Rand::randVec3f() * 0.1f;
			it.r() = 0.0f;//r.x;
			it.g() = 0.0f;//r.y;
			it.b() = 0.0f;//r.z;
			it.a() = 0.0f;
		}
	}
	
	gl::Texture velTexture( vel );
	velTexture.bind();
	
	gl::setMatricesWindow( mFboSize, false );
	gl::setViewport( mFboBounds );
	
	fbo.bindFramebuffer();
	mVelInitShader.bind();
	mVelInitShader.uniform( "initTex", 0 );
	gl::drawSolidRect( mFboBounds );
	mVelInitShader.unbind();
	fbo.unbindFramebuffer();
}
开发者ID:thessalianpine,项目名称:Eyeo2012,代码行数:27,代码来源:RepulsionApp.cpp


示例3: updateShadowMap

void BrainbowApp::updateShadowMap()
{
	mDepthFbo.bindFramebuffer();
    
	glPolygonOffset( 1.0f, 1.0f );
	glEnable( GL_POLYGON_OFFSET_FILL );
	glClear( GL_DEPTH_BUFFER_BIT );
    
	glPushAttrib( GL_VIEWPORT_BIT );
	glViewport( 0, 0, SHADOW_MAP_RESOLUTION, SHADOW_MAP_RESOLUTION );
    
	gl::pushMatrices();
	
    mLight->setShadowRenderMatrices();
    
    mDisc.draw();
    //    mCyl.draw();
    //    mCur.draw();
    mDiamond.draw();
    
	gl::popMatrices();
    
	glPopAttrib();
    
	glDisable( GL_POLYGON_OFFSET_FILL );
    
	mDepthFbo.unbindFramebuffer();
}
开发者ID:JAGormley,项目名称:Brainbow,代码行数:28,代码来源:BrainbowApp.cpp


示例4: drawIntoRoomFbo

void ShadedSphereApp::drawIntoRoomFbo()
{
	mRoomFbo.bindFramebuffer();
	gl::clear( ColorA( 0.0f, 0.0f, 0.0f, 0.0f ), true );
	
	gl::setMatricesWindow( mRoomFbo.getSize(), false );
	gl::setViewport( mRoomFbo.getBounds() );
	gl::disableAlphaBlending();
	gl::enable( GL_TEXTURE_2D );
	glEnable( GL_CULL_FACE );
	glCullFace( GL_BACK );
	Matrix44f m;
	m.setToIdentity();
	m.scale( mRoom.getDims() );
	
	//	mLightsTex.bind( 0 );
	mRoomShader.bind();
	mRoomShader.uniform( "mvpMatrix", mSpringCam.mMvpMatrix );
	mRoomShader.uniform( "mMatrix", m );
	mRoomShader.uniform( "eyePos", mSpringCam.getEye() );
	mRoomShader.uniform( "roomDims", mRoom.getDims() );
	mRoomShader.uniform( "mainPower", mRoom.getPower() );
	mRoomShader.uniform( "lightPower", mRoom.getLightPower() );
	mRoom.draw();
	mRoomShader.unbind();
	
	mRoomFbo.unbindFramebuffer();
	glDisable( GL_CULL_FACE );
}
开发者ID:AlanChatham,项目名称:Eyeo2012,代码行数:29,代码来源:ShadedSphereApp.cpp


示例5: 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


示例6: renderDepth

void KinectEcard::renderDepth(){
	if( !mDepthSurface || !mVideoSurface )
		return;

	gl::pushMatrices();
	{
		mDepthFbo.bindFramebuffer();

		// clear FBO
		gl::clear( Color::black() );
		gl::color( Color::white() );

		//
		gl::setMatricesWindowPersp( mDepthFbo.getSize() );

		// draw depth 
		gl::pushMatrices();
			gl::scale( 2, 2 );
			gl::draw( gl::Texture( mDepthSurface ) );
		gl::popMatrices();

		mDepthFbo.unbindFramebuffer();
	}
	gl::popMatrices();
}
开发者ID:AllenMooo,项目名称:cinder-sketchbook,代码行数:25,代码来源:KinectEcard.cpp


示例7: catch

void SlytherinApp::setup() {
    // setup webcam
    try {
        mCapture = Capture::create(640, 480);
        mCapture->start();
    } catch(...) {
        console() << "ERROR - failed to initialize capture" << endl;
        quit();
    }

    // setup webcam FBO
    gl::Fbo::Format format;
    format.enableColorBuffer(true);
    format.enableDepthBuffer(false);
    format.setWrap(GL_CLAMP, GL_CLAMP);

    mFBO = gl::Fbo(mCapture->getWidth(), mCapture->getHeight(), format);
    mFBO.bindFramebuffer();
        gl::setViewport(mFBO.getBounds());
        gl::clear();
    mFBO.unbindFramebuffer();

    setFrameRate(60.0f);

    mLastUpdateFrame = UINT32_MAX;
    mLinesPerFrame = 2.0f; // 1 line every 2 frames (at getFrameRate())
    mLineIndex = 0;
}
开发者ID:pizthewiz,项目名称:Slytherin,代码行数:28,代码来源:SlytherinApp.cpp


示例8: renderInterlacedHorizontal

void StereoscopicRenderingApp::renderInterlacedHorizontal( const Vec2i &size )
{
	// bind the FBO and clear its buffer
	mFbo.bindFramebuffer();
	gl::clear( mColorBackground );

	// render the scene using the over-under technique
	renderOverUnder( mFbo.getSize() );

	// unbind the FBO
	mFbo.unbindFramebuffer();

	// enable the interlace shader
	mShaderInterlaced.bind();
	mShaderInterlaced.uniform( "tex0", 0 );
	mShaderInterlaced.uniform( "window_origin", Vec2f( getWindowPos() ) );
	mShaderInterlaced.uniform( "window_size", Vec2f( getWindowSize() ) );

	// bind the FBO texture and draw a full screen rectangle,
	// which conveniently is exactly what the following line does
	gl::draw( mFbo.getTexture(), Rectf(0, float(size.y), float(size.x), 0) );

	// disable the interlace shader
	mShaderInterlaced.unbind();
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:25,代码来源:StereoscopicRenderingApp.cpp


示例9: draw

void LEDCamApp::draw()
{
	// clear out the window with black
	gl::clear( kClearColor ); 
	
	if( !mTexture ) return;
	mFbo.bindFramebuffer();
	mTexture.enableAndBind();
	mShader.bind();
	float aspect = kWindowHeight/kWindowWidth;
	cout << "Aspect: " << aspect << " \n";
	mShader.uniform( "aspect", aspect );
	mShader.uniform( "tex", 0 );
	mShader.uniform( "bright", 3.0f );
	mShader.uniform( "spacing", 3 );
	mShader.uniform( "ledCount", 100.0f );
	gl::drawSolidRect( getWindowBounds() );
	mTexture.unbind();
	mShader.unbind();
	mFbo.unbindFramebuffer();
	
	gl::Texture fboTexture = mFbo.getTexture();
	fboTexture.setFlipped();
	gl::draw( fboTexture );

}
开发者ID:controlgroup,项目名称:LEDCam,代码行数:26,代码来源:LEDCamApp.cpp


示例10: draw

void FBOBasicApp::draw()
{
	// clear the window to gray
	gl::clear( Color( 0.35f, 0.35f, 0.35f ) );

	// setup our camera to render the cube
	CameraPersp cam( getWindowWidth(), getWindowHeight(), 60.0f );
	cam.setPerspective( 60, getWindowAspectRatio(), 1, 1000 );
	cam.lookAt( Vec3f( 2.6f, 1.6f, -2.6f ), Vec3f::zero() );
	gl::setMatrices( cam );

	// set the viewport to match our window
	gl::setViewport( getWindowBounds() );

	// use the scene we rendered into the FBO as a texture
	glEnable( GL_TEXTURE_2D );
	mFbo.bindTexture();

	// draw a cube textured with the FBO
	gl::color( Color::white() );
	gl::drawCube( Vec3f::zero(), Vec3f( 2.2f, 2.2f, 2.2f ) );

	// show the FBO texture in the upper left corner
	gl::setMatricesWindow( getWindowSize() );
	gl::draw( mFbo.getTexture(0), Rectf( 0, 0, 96, 96 ) );
	
#if ! defined( CINDER_GLES ) // OpenGL ES can't do depth textures, otherwise draw the FBO's
	gl::draw( mFbo.getDepthTexture(), Rectf( 96, 0, 96 + 96, 96 ) );
#endif
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:30,代码来源:FBOBasicApp.cpp


示例11: generateNormalMap

void HiKinectApp::generateNormalMap() {
	// bind the Fbo
	mFbo.bindFramebuffer();
	// match the viewport to the Fbo dimensions
	gl::setViewport( mFbo.getBounds() );
	// setup an ortho projection
	gl::setMatricesWindow( mFbo.getWidth(), mFbo.getHeight() );
	// clear the Fbo
	gl::clear( Color( 0, 0, 0 ) );
	
	// bind the shader, set its variables
	mNormalShader.bind();
	mNormalShader.uniform( "normalStrength", mNormalStrength);
	mNormalShader.uniform( "texelWidth", 1.0f / (float)CAPTURE_WIDTH );
	
	if ( mDepthTexture ) {
		gl::pushModelView();
//		gl::translate( Vec3f( 0, mDepthTexture.getHeight(), 0 ) );
//		gl::scale( Vec3f( 1, -1, 1 ) );
		gl::draw( mDepthTexture );
		gl::popModelView();
	}
	
	// unbind the shader
	mNormalShader.unbind();
	// unbind the Fbo
	mFbo.unbindFramebuffer();
}
开发者ID:AaronMeyers,项目名称:cinder_projects,代码行数:28,代码来源:HiKinectApp.cpp


示例12: setup

void ChargesApp::setup()
{
	//gl::disableVerticalSync();

	gl::Fbo::Format format;
	format.enableDepthBuffer( false );
	format.setSamples( 4 );

	mFbo = gl::Fbo( 1280, 800, format );
	mKawaseBloom = mndl::gl::fx::KawaseBloom( mFbo.getWidth(), mFbo.getHeight() );

	mEffectCharge.setup();
	mEffectCharge.instantiate();
	mEffectCharge.setBounds( mFbo.getBounds() );

	// Leap
	mLeap = LeapSdk::Device::create();
	mLeapCallbackId = mLeap->addCallback( &ChargesApp::onFrame, this );

	// params
	mndl::kit::params::PInterfaceGl::load( "params.xml" );
	mParams = mndl::kit::params::PInterfaceGl( "Parameters", Vec2i( 200, 300 ) );
	mParams.addPersistentSizeAndPosition();
	mParams.addParam( "Fps", &mFps, "", true );
	mParams.addSeparator();
	mParams.addPersistentParam( "Line width", &mLineWidth, 4.5f, "min=.5 max=10 step=.1" );
	mParams.addPersistentParam( "Bloom strength", &mBloomStrength, .8f, "min=0 max=1 step=.05" );
	mParams.addPersistentParam( "Finger disapperance thr", &mFingerDisapperanceThreshold, .1f, "min=0 max=2 step=.05" );

	mndl::kit::params::PInterfaceGl::showAllParams( false );
}
开发者ID:gaborpapp,项目名称:apps,代码行数:31,代码来源:ChargesApp.cpp


示例13: setFboPositions

void CatalogApp::setFboPositions( gl::Fbo &fbo )
{
	int numBrightStars = mBrightStars.size();

	int index = 0;
	
	Surface32f posSurface( fbo.getTexture() );
	Surface32f::Iter it = posSurface.getIter();
	while( it.line() ){
		while( it.pixel() ){
			Vec3f pos = Vec3f( 1000000.0f, 0.0f, 0.0f );
			float col = 0.4f;
			float rad = 0.0f;
			if( index < numBrightStars ){
				pos = mBrightStars[index]->mPos;
				col = mBrightStars[index]->mColor;
				rad = floor( constrain( ( ( 6.0f - ( mBrightStars[index]->mAbsoluteMag ) )/6.0f ), 0.3f, 1.0f ) * 3.0f * 1000 );
			}
			it.r() = pos.x;
			it.g() = pos.y;
			it.b() = pos.z;
			it.a() = rad + col;

			index ++;
		}
	}

	gl::Texture posTexture( posSurface );
	fbo.bindFramebuffer();
	gl::setMatricesWindow( fbo.getSize(), false );
	gl::setViewport( fbo.getBounds() );
	gl::clear( ColorA( 0, 0, 0, 0 ), true );
	gl::draw( posTexture );
	fbo.unbindFramebuffer();
}
开发者ID:thessalianpine,项目名称:Eyeo2012,代码行数:35,代码来源:CatalogApp.cpp


示例14: updateShadowMap

void ShadowMapSample::updateShadowMap()
{
	mDepthFbo.bindFramebuffer();

	glPolygonOffset( 1.0f, 1.0f );
	glEnable( GL_POLYGON_OFFSET_FILL );
	glClear( GL_DEPTH_BUFFER_BIT );

	glPushAttrib( GL_VIEWPORT_BIT );
	glViewport( 0, 0, SHADOW_MAP_RESOLUTION, SHADOW_MAP_RESOLUTION );

	gl::pushMatrices();
	
		mLight->setShadowRenderMatrices();

		mBackboard.draw();
		mTorus.draw();
		gl::drawCube( vec3::zero(), vec3( 1, 1, 1 ) );
	gl::popMatrices();

	glPopAttrib();

	glDisable( GL_POLYGON_OFFSET_FILL );

	mDepthFbo.unbindFramebuffer();
}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:26,代码来源:main.cpp


示例15: drawIntoRoomFbo

void BubbleChamberApp::drawIntoRoomFbo()
{
	mRoomFbo.bindFramebuffer();
	gl::clear( ColorA( 0.0f, 0.0f, 0.0f, 0.0f ), true );
	
	gl::setMatricesWindow( mRoomFbo.getSize(), false );
	gl::setViewport( mRoomFbo.getBounds() );
	gl::disableAlphaBlending();
	gl::enable( GL_TEXTURE_2D );
	glEnable( GL_CULL_FACE );
	glCullFace( GL_BACK );
	Matrix44f m;
	m.setToIdentity();
	m.scale( mRoom.getDims() );

	mRoomShader.bind();
	mRoomShader.uniform( "mvpMatrix", mActiveCam.mMvpMatrix );
	mRoomShader.uniform( "mMatrix", m );
	mRoomShader.uniform( "eyePos", mActiveCam.mCam.getEyePoint() );
	mRoomShader.uniform( "roomDims", mRoom.getDims() );
	mRoomShader.uniform( "power", mRoom.getPower() );
	mRoomShader.uniform( "lightPower", mRoom.getLightPower() );
	mRoomShader.uniform( "timePer", mRoom.getTimePer() * 1.5f + 0.5f );
	mRoom.draw();
	mRoomShader.unbind();
	
	mRoomFbo.unbindFramebuffer();
	glDisable( GL_CULL_FACE );
}
开发者ID:AlanChatham,项目名称:002.2-CloudChamber,代码行数:29,代码来源:BubbleChamberApp.cpp


示例16: renderDisplacementMap

void SmoothDisplacementMappingApp::renderDisplacementMap()
{
	if( mDispMapShader && mDispMapFbo ) 
	{
		mDispMapFbo.bindFramebuffer();
		{
			// clear the color buffer
			gl::clear();			

			// setup viewport and matrices 
			glPushAttrib( GL_VIEWPORT_BIT );
			gl::setViewport( mDispMapFbo.getBounds() );

			gl::pushMatrices();
			gl::setMatricesWindow( mDispMapFbo.getSize(), false );

			// render the displacement map
			mDispMapShader.bind();
			mDispMapShader.uniform( "time", float( getElapsedSeconds() ) );
			mDispMapShader.uniform( "amplitude", mAmplitude );
			gl::drawSolidRect( mDispMapFbo.getBounds() );
			mDispMapShader.unbind();

			// clean up after ourselves
			gl::popMatrices();
			glPopAttrib();
		}
		mDispMapFbo.unbindFramebuffer();
	}
}
开发者ID:audionerd,项目名称:Cinder-Samples,代码行数:30,代码来源:SmoothDisplacementMappingApp.cpp


示例17: renderAnaglyph

void StereoscopicRenderingApp::renderAnaglyph(  const Vec2i &size, const ColorA &left, const ColorA &right )
{	
	// bind the FBO and clear its buffer
	mFbo.bindFramebuffer();
	gl::clear( mColorBackground );

	// render the scene using the side-by-side technique
	renderSideBySide( mFbo.getSize() );

	// unbind the FBO
	mFbo.unbindFramebuffer();

	// enable the anaglyph shader
	mShaderAnaglyph.bind();
	mShaderAnaglyph.uniform( "tex0", 0 );
	mShaderAnaglyph.uniform( "clr_left", left );
	mShaderAnaglyph.uniform( "clr_right", right );	

	// bind the FBO texture and draw a full screen rectangle,
	// which conveniently is exactly what the following line does
	gl::draw( mFbo.getTexture(), Rectf(0, float(size.y), float(size.x), 0) );

	// disable the anaglyph shader
	mShaderAnaglyph.unbind();
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:25,代码来源:StereoscopicRenderingApp.cpp


示例18: getWindowWidth

void ShaderToyApp::resize()
{
	// Create/resize frame buffers (no multisampling)
	mBufferCurrent = gl::Fbo( getWindowWidth(), getWindowHeight() );
	mBufferNext = gl::Fbo( getWindowWidth(), getWindowHeight() );

	mBufferCurrent.getTexture().setFlipped(true);
	mBufferNext.getTexture().setFlipped(true);
}
开发者ID:20SecondsToSun,项目名称:Cinder-Samples,代码行数:9,代码来源:ShaderToyApp.cpp


示例19:

void	KinectEcard::clear(){
	mStoredDepthFbo.bindFramebuffer();
	gl::clear( Color::white() );
	mStoredDepthFbo.unbindFramebuffer();

	mStoredVideoFbo.bindFramebuffer();
	gl::clear( Color::white() );
	mStoredVideoFbo.unbindFramebuffer();
}
开发者ID:AllenMooo,项目名称:cinder-sketchbook,代码行数:9,代码来源:KinectEcard.cpp


示例20: draw

void FBOMultipleTargetsApp::draw()
{
	// clear the window to gray
	gl::clear( Color( 0.35f, 0.35f, 0.35f ) );

	// set the viewport to match our window
	gl::setViewport( getWindowBounds() );

	// draw the two textures we've created side-by-side
	gl::setMatricesWindow( getWindowSize() );
	gl::draw( mFbo.getTexture(0), mFbo.getTexture(0).getBounds() );
	gl::draw( mFbo.getTexture(1), mFbo.getTexture(1).getBounds() + Vec2f(mFbo.getTexture(0).getWidth(),0) );
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:13,代码来源:FBOMultipleTargetsApp.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ gl::FboRef类代码示例发布时间:2022-05-31
下一篇:
C++ gl::BatchRef类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap