本文整理汇总了C++中gl::Fbo::bindDepthTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ Fbo::bindDepthTexture方法的具体用法?C++ Fbo::bindDepthTexture怎么用?C++ Fbo::bindDepthTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gl::Fbo
的用法示例。
在下文中一共展示了Fbo::bindDepthTexture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initShadowMap
void BrainbowApp::initShadowMap()
{
mDepthFbo = gl::Fbo( SHADOW_MAP_RESOLUTION, SHADOW_MAP_RESOLUTION, false, false, true );
mDepthFbo.bindDepthTexture();
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
}
示例2: draw
void ShadowMapSample::draw()
{
gl::clear();
gl::enableDepthWrite();
glEnable( GL_LIGHTING );
updateShadowMap();
gl::enableDepthRead();
glEnable( GL_TEXTURE_2D );
mDepthFbo.bindDepthTexture();
mShader.bind();
mShader.uniform( "shadowTransMatrix", mLight->getShadowTransformationMatrix( *mCamera ) );
if( mLookThroughCamera )
gl::setMatrices( *mCamera );
else
gl::setMatrices( mLight->getShadowCamera() );
mLight->update( *mCamera );
glPushMatrix();
mBackboard.draw();
mTorus.draw();
gl::drawCube( vec3::zero(), vec3( 1, 1, 1 ) );
glPopMatrix();
mShader.unbind();
mDepthFbo.unbindTexture();
// Draw the lighting frustum unless we're looking through it
if( mLookThroughCamera ) {
glDisable( GL_LIGHTING );
glColor3f( 1.0f, 1.0f, 0.1f );
gl::drawFrustum( mLight->getShadowCamera() );
}
if( mDrawDepthMap ) { // there are faster ways to achieve this, but this is a handy way to see the depth map
gl::setMatricesWindow( getWindowSize() );
Surface32f shadowMapSurface( mDepthFbo.getDepthTexture() );
ip::hdrNormalize( &shadowMapSurface );
gl::color( Color::white() );
gl::draw( gl::Texture( shadowMapSurface ), Rectf( 0, 0, 128, 128 ) );
}
}
示例3: draw
void BrainbowApp::draw()
{
gl::setViewport( getWindowBounds() );
// SCREENPULSE
// changes every 12.5 seconds
float gray = (cos(getElapsedSeconds()/4)*.3)/2 ;
float otherCol = (sin(getElapsedSeconds()/4)*.2)/2;
screenCol = Vec3f (lightFade+gray, lightFade, (lightFade*2)-otherCol);
if (sceneOne)
gl::clear( Color(lightFade+gray, lightFade, (lightFade*2)-otherCol) );
if (sceneTwo)
gl::clear( Color(1, 1, 1) );
// FADE IN INTRO
if (lightFade < .5){
lightFade += .0005;
}
if (mHands.empty())
mLight->disable();
updateShadowMap();
gl::enableDepthRead();
gl::enableDepthWrite();
mShader.bind();
glEnable( GL_TEXTURE_2D );
mDepthFbo.bindDepthTexture();
mShader.bind();
// FIRST SCENE
if (sceneOne){
// disc
if (zshift > 0){
glPushMatrix();
glTranslated( 640, 400, zshift - 200);
if (shift2 && discOp > 1)
glScalef(discOp, discOp, 0);
// cout << discOp << endl;
mDisc.draw();
glPopMatrix();
}
//cloud
glPushMatrix();
glTranslated( getWindowWidth() * 0.5f, getWindowHeight() * 0.5f, zshift );
// if (lightFade > .45f)
mCloud.update(scaledX, scaledY, scaledZ, diamondFade, 1);
glPopMatrix();
if (drawDiamond){
glPushMatrix();
glTranslated( getWindowWidth() * 0.5f, getWindowHeight() * 0.5f, zshift);
mDiamond.draw();
glPopMatrix();
}
}
// SECOND SCENE
if (sceneTwo){
mLight->lookAt( Vec3f(scaledX, scaledY, scaledZ +200), Vec3f (getWindowWidth()*.05, getWindowHeight() * 0.5f, 0.0f ));
// cursor
glPushMatrix();
glTranslated( scaledX, scaledY, scaledZ );
mCur.draw();
if (scaledZ < 375 && scaledZ > 350)
gl::drawSphere(Vec3f(0,0,0), (scaledZ-350)*.4);
if (scaledZ >= 375)
gl::drawSphere(Vec3f(0,0,0), 25*.4);
glPopMatrix();
// rotate whole scene; implement this later:
// if (targetFilled){
// glPushMatrix();
// glRotatef(getElapsedSeconds()*10, Vec3f (640, 400, 350) );
// }
for (int i = 0; i < cubes.size() ; i++){
glPushMatrix();
glTranslatef(cubes[i].getLocation());
cubes[i].update(.01f, screenCol);
glPopMatrix();
}
offCounter = 0;
for (int i = 0; i < targets.size() ; i++){
glPushMatrix();
glTranslatef(targets[i].getLocation());
targets[i].update(.01f, handPos, screenCol);
if (targets[i].getBoxed() && targets[i].getBoxNumber() < 15 ){
addCube(targets[i].getLocation().x, targets[i].getLocation().y, targets[i].getLocation().z);
//.........这里部分代码省略.........
示例4: draw
void PopGameApp::draw()
{
if(getElapsedFrames()>200)return;
gl::pushMatrices();
gl::setMatrices( *mCamera );
gl::enable(GL_DEPTH_TEST);
gl::clear(ColorA(0.5,0.5,0.5,1));
gl::enableDepthWrite();
glEnable( GL_LIGHTING );
updateShadowMap();
gl::enableDepthRead();
// clear out the window with black
glEnable( GL_TEXTURE_2D );
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5);
mShader.bind();
mDepthFbo.bindDepthTexture(1);
mShader.uniform( "shadowTransMatrix", mLight->getShadowTransformationMatrix( *mCamera ) );
//gl::enable(GL_BLEND);
mLight->update( *mCamera );
gl::pushMatrices();
stage.int_draw();
gl::popMatrices();
gl::popMatrices();
// gl::setMatrices( *mCamera );
mShader.unbind();
gl::disable (GL_DEPTH_TEST);
glDisable( GL_LIGHTING );
glDisable (GL_ALPHA_TEST);
glEnable(GL_BLEND);
gl::enableAlphaBlending();
stage2D.int_draw();
glDisable(GL_BLEND);
gl::disableAlphaBlending();
/*
glDisable( GL_LIGHTING );
gl::setMatricesWindow( getWindowSize() );
Surface32f shadowMapSurface( mDepthFbo.getDepthTexture() );
ip::hdrNormalize( &shadowMapSurface );
gl::color( Color::white() );
gl::draw( gl::Texture( shadowMapSurface ), Rectf( 0, 0, 128*2, 128*2 ) );
*/
}