本文整理汇总了C++中gl::Fbo::getBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ Fbo::getBounds方法的具体用法?C++ Fbo::getBounds怎么用?C++ Fbo::getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gl::Fbo
的用法示例。
在下文中一共展示了Fbo::getBounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: 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();
}
示例3: getWindowSize
void PixarDemo2012::renderGradientFBO()
{
gl::enableAlphaBlending();
gl::SaveFramebufferBinding bindingSaver;
mGradientFBO.bindFramebuffer();
gl::setViewport( mGradientFBO.getBounds() );
gl::setMatricesWindow( getWindowSize(), true );
gl::clear( ColorA(0.0f,0.0f,0.0f,1.0f) );
glDisable( GL_TEXTURE_2D );
// mGradientFBO.bindTexture(0);
mGradientShader.bind();
float what = mTime;
mGradientShader.uniform("mTime", what);
mGradientShader.uniform("resolution", Vec2f((float)getWindowWidth(),(float)getWindowHeight()));
gl::drawSolidRect( getWindowBounds() );
mGradientShader.unbind();
// mGradientFBO.unbindTexture();
gl::popMatrices();
}
示例4: setup
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;
}
示例5: 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());
}
示例6: 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 );
}
示例7: 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();
}
示例8: 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();
}
示例9: 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 );
}
示例10: 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 );
}
示例11: 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 ) );
}
示例12: pingPongBlur
/*
* @Description: need to blur[the SSAO texture] horizonatally then vertically (for shader performance reasons). Called ping-ponging as it one FBO drawn to another
* @param: KeyEvent
* @return: none
*/
void Base_ThreeD_ProjectApp::pingPongBlur()
{
//render horizontal blue first
gl::setViewport( mPingPongBlurH.getBounds() );
mPingPongBlurH.bindFramebuffer();
glClearColor( 0.5f, 0.5f, 0.5f, 1 );
glClearDepth(1.0f);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
gl::setMatricesWindow( mPingPongBlurH.getSize() );
mSSAOMap.getTexture().bind(0);
mHBlurShader.bind();
mHBlurShader.uniform("RTScene", 0);
gl::drawSolidRect( Rectf( 0, 0, getWindowWidth(), getWindowHeight()) );
mHBlurShader.unbind();
mSSAOMap.getTexture().unbind(0);
mPingPongBlurH.unbindFramebuffer();
//gl::setViewport( getWindowBounds() ); //redundant
//now render vertical blur
gl::setViewport( mPingPongBlurV.getBounds() );
mPingPongBlurV.bindFramebuffer();
glClearColor( 0.5f, 0.5f, 0.5f, 1 );
glClearDepth(1.0f);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
gl::setMatricesWindow( mPingPongBlurV.getSize() );
mPingPongBlurH.getTexture().bind(0);
mHBlurShader.bind();
mHBlurShader.uniform("RTBlurH", 0);
gl::drawSolidRect( Rectf( 0, 0, getWindowWidth(), getWindowHeight()) );
mHBlurShader.unbind();
mPingPongBlurH.getTexture().unbind(0);
mPingPongBlurV.unbindFramebuffer();
gl::setViewport( getWindowBounds() );
}
示例13: fbo
void KinectEcard::snapshot(){
gl::Fbo fbo( 640, 480, false );
// render stored depth FBO
fbo.bindFramebuffer();
gl::pushMatrices();
gl::clear( Color::black() );
gl::color( Color::white() );
gl::setMatricesWindowPersp( fbo.getSize() );
mDepthCompareShader.bind();
mDepthCompareShader.uniform( "tex0", 0 );
mDepthCompareShader.uniform( "tex1", 1 );
mDepthFbo.bindTexture(0);
mStoredDepthFbo.bindTexture(1);
gl::translate( 0, 480 );
gl::scale( 1, -1 );
gl::drawSolidRect( fbo.getBounds() );
mDepthCompareShader.unbind();
gl::popMatrices();
fbo.unbindFramebuffer();
// save stored depth fbo
fbo.blitTo( mStoredDepthFbo, fbo.getBounds(), mStoredDepthFbo.getBounds() );
// render substracted video fbo
fbo.bindFramebuffer();
gl::pushMatrices();
gl::clear( Color::black() );
gl::color( Color::white() );
gl::setMatricesWindowPersp( mSubstractedVideoFbo.getSize() );
gl::draw( mSubstractedVideoFbo.getTexture() );
gl::popMatrices();
fbo.unbindFramebuffer();
// save it
fbo.blitTo( mStoredVideoFbo, fbo.getBounds(), mStoredVideoFbo.getBounds() );
}
示例14: renderSSAOToFBO
/*
* @Description: render SSAO now - woohoo!
* @param: KeyEvent
* @return: none
*/
void Base_ThreeD_ProjectApp::renderSSAOToFBO()
{
gl::setViewport( mSSAOMap.getBounds() );
//render out main scene to FBO
mSSAOMap.bindFramebuffer();
glClearColor( 0.5f, 0.5f, 0.5f, 1 );
glClearDepth(1.0f);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
gl::setMatricesWindow( mSSAOMap.getSize() );
mRandomNoise.bind(1);
mNormalDepthMap.getTexture().bind(2);
mSSAOShader.bind();
mSSAOShader.uniform("rnm", 1 );
mSSAOShader.uniform("normalMap", 2 );
//look at shader and see you can set these through the client if you so desire.
// mSSAOShader.uniform("rnm", 1 );
// mSSAOShader.uniform("normalMap", 2 );
// mSSAOShader.uniform("totStrength", 1.38f);
// mSSAOShader.uniform("strength", 0.07f);
// mSSAOShader.uniform("offset", 10.0f);
// mSSAOShader.uniform("falloff", 0.2f);
// mSSAOShader.uniform("rad", 0.8f);
// mSSAOShader.uniform("rnm", 1 );
// mSSAOShader.uniform("normalMap", 2 );
// mSSAOShader.uniform("farClipDist", 20.0f);
// mSSAOShader.uniform("screenSizeWidth", (float)getWindowWidth());
// mSSAOShader.uniform("screenSizeHeight", (float)getWindowHeight());
// mSSAOShader.uniform("grandom", 1 );
// mSSAOShader.uniform("gnormals", 2 );
// mSSAOShader.uniform("gdepth", 1 );
// mSSAOShader.uniform("gdiffuse", 1 );
gl::drawSolidRect( Rectf( 0, 0, getWindowWidth(), getWindowHeight()) );
mSSAOShader.unbind();
mNormalDepthMap.getTexture().unbind(2);
mRandomNoise.unbind(1);
mSSAOMap.unbindFramebuffer();
gl::setViewport( getWindowBounds() );
}
示例15: copyBlur
void Grove::copyBlur(gl::Fbo& source, gl::Fbo& target, Vec2f sampleOffset)
{
// bind the blur shader
mBlurShader.bind();
mBlurShader.uniform("tex0", 0); // use texture unit 0
mBlurShader.uniform("sampleOffset", sampleOffset);
// copy a horizontally blurred version of our scene into the first blur Fbo
gl::setViewport( target.getBounds() );
target.bindFramebuffer();
source.bindTexture(0);
gl::pushMatrices();
gl::setMatricesWindow(target.getSize(), false);
gl::clear( Color::black() );
gl::drawSolidRect( target.getBounds() );
gl::popMatrices();
source.unbindTexture();
target.unbindFramebuffer();
// unbind the shader
mBlurShader.unbind();
}