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

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

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

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



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

示例1: drawBall

void QuaternionAccumApp::drawBall()
{
	Vec3f pos = mSpline.getPosition( mSplineValue );
	Vec3f delta = pos - mLastPos;
	// our axis of rotation is the normal to the spline at this point
	Vec3f normal = Vec3f( delta.z, 0, -delta.x );
	
	// rotation amount (in radians) is the distance we've traveled divided by the radius of the ball
	float rotation = delta.length() / BALL_RADIUS;
	if( rotation ) {
		// increment our quaternion by a new quaternion representing how much rotating we did since the last frame
		Quatf incQuat( normal, rotation );
		mQuat *= incQuat;
		mQuat.normalize();
	}
	
	gl::translate( Vec3f( 0.0f, BALL_RADIUS, 0.0f ) + pos );
	gl::scale( Vec3f( BALL_RADIUS, BALL_RADIUS, BALL_RADIUS ) );
	gl::rotate( mQuat );
	
	gl::color( Color( 1, 1, 1 ) );
	mBallTexture.enableAndBind();
	gl::drawSphere( Vec3f::zero(), 1.0f, 60 );
	mBallTexture.disable();
	
	mLastPos = pos;
}
开发者ID:kevinbs,项目名称:Cinder-portfolio,代码行数:27,代码来源:QuaternionAccumApp.cpp


示例2: draw

void TextureTestApp::draw()
{
	gl::clear(Color(0.2f, 0.2f, 0.2f));

  // カメラの状態から行列を作成
  // 視点座標変換用と正規化デバイス座標変換用の2つを用意する
  gl::setMatrices(camera);

  // ライティング開始
  light->enable();

  // ローカル→ワールド変換行列を用意
  gl::scale(100.0, 100.0, 100.0);
  gl::rotate(Vec3f(rx, ry, rz));

  gl::pushModelView();
  // テクスチャを拘束
  image.bind();
  gl::translate(Vec3f(1.5f, 0, 0));
  gl::color(Color::white());
  // ポリゴンを描画
  gl::drawCube(Vec3f(0.0, 0.0, 0.0), Vec3f(2.0, 2.0, 2.0));
  //gl::drawCylinder(1, 2, 2, 12, 2);

  // 拘束を解除
  image.unbind();
  gl::popModelView();

  gl::pushModelView();
  gl::color(Color(1, 0, 0));
  gl::translate(Vec3f(-3, 0, 0));
  gl::drawCube(Vec3f(1, 0, 0), Vec3f(2.f, 2.f, 2.f));
  gl::popModelView();

}
开发者ID:PS14,项目名称:Cinder-Sample,代码行数:35,代码来源:TextureTestApp.cpp


示例3: Vec2i

void RDiffusionApp::setup()
{
	mReactionU = 0.25f;
	mReactionV = 0.04f;
	mReactionK = 0.047f;
	mReactionF = 0.1f;

	mMousePressed = false;
	
	// Setup the parameters
	mParams = params::InterfaceGl( "Parameters", Vec2i( 175, 100 ) );
	mParams.addParam( "Reaction u", &mReactionU, "min=0.0 max=0.4 step=0.01 keyIncr=u keyDecr=U" );
	mParams.addParam( "Reaction v", &mReactionV, "min=0.0 max=0.4 step=0.01 keyIncr=v keyDecr=V" );
	mParams.addParam( "Reaction k", &mReactionK, "min=0.0 max=1.0 step=0.001 keyIncr=k keyDecr=K" );	
	mParams.addParam( "Reaction f", &mReactionF, "min=0.0 max=1.0 step=0.001 keyIncr=f keyDecr=F" );
	
	gl::Fbo::Format format;
	format.enableDepthBuffer( false );
	
	mCurrentFBO = 0;
	mOtherFBO = 1;
	mFBOs[0] = gl::Fbo( FBO_WIDTH, FBO_HEIGHT, format );
	mFBOs[1] = gl::Fbo( FBO_WIDTH, FBO_HEIGHT, format );
	
	mShader = gl::GlslProg( loadResource( RES_PASS_THRU_VERT ), loadResource( RES_GSRD_FRAG ) );
	mTexture = gl::Texture( loadImage( loadResource( RES_STARTER_IMAGE ) ) );
	mTexture.setWrap( GL_REPEAT, GL_REPEAT );
	mTexture.setMinFilter( GL_LINEAR );
	mTexture.setMagFilter( GL_LINEAR );
	mTexture.bind( 1 );
	
	resetFBOs();
}
开发者ID:AaronMeyers,项目名称:Cinder,代码行数:33,代码来源:RDiffusionApp.cpp


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


示例5: getWindowBounds

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


示例6: ColorA

void QuickTimeSampleApp::loadMovieFile( const fs::path& moviePath )
{
	try {
		// load up the movie, set it to loop, and begin playing
		mMovie = qtime::MovieGl( moviePath );
		mMovie.setLoop();
		mMovie.play();
		
		// create a texture for showing some info about the movie
		TextLayout infoText;
		infoText.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) );
		infoText.setColor( Color::white() );
		infoText.addCenteredLine( getPathFileName( moviePath.string() ) );
		infoText.addLine( toString( mMovie.getWidth() ) + " x " + toString( mMovie.getHeight() ) + " pixels" );
		infoText.addLine( toString( mMovie.getDuration() ) + " seconds" );
		infoText.addLine( toString( mMovie.getNumFrames() ) + " frames" );
		infoText.addLine( toString( mMovie.getFramerate() ) + " fps" );
		infoText.setBorder( 4, 2 );
		mInfoTexture = gl::Texture( infoText.render( true ) );
	}
	catch( ... ) {
		console() << "Unable to load the movie." << std::endl;
		mMovie.reset();
		mInfoTexture.reset();
	}

	mFrameTexture.reset();
}
开发者ID:kevinbs,项目名称:Cinder-portfolio,代码行数:28,代码来源:quickTimeSample.cpp


示例7: draw

void BoidsApp::draw()
{	
	
	glEnable( GL_TEXTURE_2D );
	gl::clear( Color( 0, 0, 0 ), true );	//this clears the old images off the window.
	
	
	mParticleTexture.bind();
	flock_one.draw();
	flock_two.draw();
	mParticleTexture.unbind();
	
	//drawCapture();
	drawPolyLines();

	/*
	if( mSaveFrames ){
		writeImage( getHomeDirectory() + "flocking/image_" + toString( getElapsedFrames() ) + ".png", copyWindowSurface() );
	}
		*/
	
	

	
	// DRAW PARAMS WINDOW
	params::InterfaceGl::draw();
}
开发者ID:alterscape,项目名称:CinderCVBoids,代码行数:27,代码来源:BoidsApp.cpp


示例8: draw

void TutorialApp::draw()
{
    if(isFirst) {
        gl::clear( Color( 0, 0, 0 ), true );
        isFirst = false;
    }

    gl::enableAlphaBlending();
	
	if( mDrawImage ){
		mTexture.enableAndBind();
		gl::draw( mTexture, getWindowBounds() );
	}
    
//	if( mDrawParticles ){
		glDisable( GL_TEXTURE_2D );
		mParticleController.draw();
//	}
    
    if( mDrawImage ){
        mOverlay.enableAndBind();
        gl::draw( mOverlay, getWindowBounds() );
    }

//	if( mSaveFrames ){
//		writeImage( getHomeDirectory() / ( "image_" + toString( getElapsedFrames() ) + ".png" ), copyWindowSurface() );
//	}
}
开发者ID:newshorts,项目名称:Examples,代码行数:28,代码来源:TutorialApp.cpp


示例9: draw

void FastTrailsApp::draw()
{
	// clear window
	gl::clear(); 

	// set render states
	gl::enableWireframe();
	gl::enableAlphaBlending();

	gl::enableDepthRead();
	gl::enableDepthWrite();

	// enable 3D camera
	gl::pushMatrices();
	gl::setMatrices( mCamera.getCamera() );

	// draw VBO mesh using texture
	mTexture.enableAndBind();
	gl::drawRange( mVboMesh, 0, mTrail.size(), 0, mTrail.size()-1 );
	mTexture.unbind();

	// restore camera and render states
	gl::popMatrices();

	gl::disableDepthWrite();
	gl::disableDepthRead();

	gl::disableAlphaBlending();
	gl::disableWireframe();
}
开发者ID:audionerd,项目名称:Cinder-Samples,代码行数:30,代码来源:FastTrailsApp.cpp


示例10: render

void BloomingNeonApp::render()
{
	// get the current viewport
	Area viewport = gl::getViewport();

	// adjust the aspect ratio of the camera
	mCamera.setAspectRatio( viewport.getWidth() / (float) viewport.getHeight() );
	
	// render our scene (see the Picking3D sample for more info)
	gl::pushMatrices();

		gl::setMatrices( mCamera );
		gl::enableDepthRead();
		gl::enableDepthWrite();
		
		mTexture.enableAndBind();
			mShaderPhong.bind();
			mShaderPhong.uniform("tex0", 0);
				gl::pushModelView();
				gl::multModelView( mTransform );
					gl::color( Color::white() );
					gl::draw( mMesh );
				gl::popModelView();		
			mShaderPhong.unbind();
		mTexture.unbind();

		gl::disableDepthWrite();
		gl::disableDepthRead();

	gl::popMatrices();
}
开发者ID:Joelone,项目名称:Cinder-Samples,代码行数:31,代码来源:BloomingNeonApp.cpp


示例11: ColorA

void QuickTimePlayer::loadMovieFile( const fs::path &moviePath )
{
	try {
		// load up the movie, set it to loop, and begin playing
		mMovie = qtime::MovieGl::create( moviePath );
		
		mMovie->setLoop(mMovie->getDuration()<30.0f) ;
		mMovie->play();
		
		// create a texture for showing some info about the movie
		TextLayout infoText;
		infoText.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) );
		infoText.setColor( Color::white() );
		infoText.addCenteredLine( moviePath.filename().string() );
		infoText.addLine( toString( mMovie->getWidth() ) + " x " + toString( mMovie->getHeight() ) + " pixels" );
		infoText.addLine( toString( mMovie->getDuration() ) + " seconds" );
		infoText.addLine( toString( mMovie->getNumFrames() ) + " frames" );
		infoText.addLine( toString( mMovie->getFramerate() ) + " fps" );
		infoText.setBorder( 4, 2 );
		mInfoTexture = gl::Texture( infoText.render( true ) );
	}
	catch (const std::exception &e) {
		console() << "Unable to load the movie:" << e.what() << std::endl;
		//mMovie->reset();
		mInfoTexture.reset();
	}

	mFrameTexture.reset();
}
开发者ID:Reymenta-Visuals,项目名称:Reymenta-Quicktime-Player,代码行数:29,代码来源:QuickTimePlayer.cpp


示例12: float

void AudioVisualizerApp::draw()
{
	gl::clear();

	// use camera
	gl::pushMatrices();
	gl::setMatrices(mCamera);
	{
		// bind shader
		mShader.bind();
		mShader.uniform("uTexOffset", mOffset / float(kHistory));
		mShader.uniform("uLeftTex", 0);
		mShader.uniform("uRightTex", 1);

		// create textures from our channels and bind them
		mTextureLeft = gl::Texture(mChannelLeft, mTextureFormat);
		mTextureRight = gl::Texture(mChannelRight, mTextureFormat);

		mTextureLeft.enableAndBind();
		mTextureRight.bind(1);

		// draw mesh using additive blending
		gl::enableAdditiveBlending();
		gl::color( Color(1, 1, 1) );
		gl::draw( mMesh );
		gl::disableAlphaBlending();

		// unbind textures and shader
		mTextureRight.unbind();
		mTextureLeft.unbind();
		mShader.unbind();
	}
	gl::popMatrices();
}
开发者ID:20SecondsToSun,项目名称:Cinder-Samples,代码行数:34,代码来源:AudioVisualizerApp.cpp


示例13: drawShadowCasters

void DeferredRenderingApp::drawShadowCasters(gl::GlslProg* deferShader) const
{
	//just some test objects
    if(deferShader != NULL) {
        deferShader->uniform("useTexture", 1.0f);
        deferShader->uniform("tex0", 0);
        mEarthTex.bind(0);
    }
    
    glColor3ub(255,255,255);
    gl::drawSphere( Vec3f(-1.0, 0.0,-1.0), 1.0f, 30 );
    
    if(deferShader != NULL) {
        deferShader->uniform("useTexture", 0.0f);
        mEarthTex.unbind(0);
    }
    
	glColor3ub(0,255,0);
    gl::drawCube( Vec3f( 1.0f, 0.0f, 1.0f ), Vec3f( 2.0f, 2.0f, 2.0f ) );
    
    glColor3ub(255,0,255);
    gl::drawCube( Vec3f( 0.0f, 0.0f, 4.5f ), Vec3f( 1.0f, 2.0f, 1.0f ) );
    
    glColor3ub(255,255,0);
    gl::drawCube( Vec3f( 3.0f, 0.0f, -1.5f ), Vec3f( 1.0f, 3.0f, 1.0f ) );
    
	glColor3ub(255,0,255);
    gl::pushMatrices();
	glTranslatef(-2.0f, -0.7f, 2.0f);
	glRotated(90.0f, 1, 0, 0);
    gl::drawTorus( 1.0f, 0.3f, 32, 64 );
	gl::popMatrices();
    
}
开发者ID:eighteight,项目名称:CinderEight,代码行数:34,代码来源:DeferredRenderingApp.cpp


示例14: drawTerrain

void TerrainApp::drawTerrain()
{
	mRd.getHeightsTexture().bind( 0 );
	mRd.getNormalsTexture().bind( 1 );
	mGradientTex.bind( 2 );
	mSandNormalTex.bind( 3 );
	mTerrainShader.bind();
	mTerrainShader.uniform( "heightsTex", 0 );
	mTerrainShader.uniform( "normalsTex", 1 );
	mTerrainShader.uniform( "gradientTex", 2 );
	mTerrainShader.uniform( "sandNormalTex", 3 );
	mTerrainShader.uniform( "mvpMatrix", mSpringCam.mMvpMatrix );
	mTerrainShader.uniform( "terrainScale", mTerrainScale );
	mTerrainShader.uniform( "roomDims", mRoom.getDims() );
	mTerrainShader.uniform( "zoomMulti", mZoomMulti );//lerp( mZoomMulti, 1.0f, mRoom.getPower() ) );
	mTerrainShader.uniform( "power", mRoom.getPower() );
	mTerrainShader.uniform( "eyePos", mSpringCam.getEye() );
	mTerrainShader.uniform( "lightPos", mLightPos );
	mTerrainShader.uniform( "fogColor", mFogColor );
	mTerrainShader.uniform( "sandColor", mSandColor );
	mTerrainShader.uniform( "mousePosNorm", -( mMousePosNorm - Vec2f( 0.5f, 0.5f ) ) * getElapsedSeconds() * 2.0f );
	mTerrainShader.uniform( "spherePos", mSphere.getCenter() );
	mTerrainShader.uniform( "sphereRadius", mSphere.getRadius() );
	mTerrain.draw();
	mTerrainShader.unbind();
}
开发者ID:AlanChatham,项目名称:Eyeo2012,代码行数:26,代码来源:TerrainApp.cpp


示例15: touchesBegan

void PhotoBoothApp::touchesBegan( TouchEvent event ){

    TouchEvent::Touch touch = event.getTouches().front();
    Vec2f cameraButtonTargetPos = Vec2f(mCameraButtonPos.value());
    
    float touchX = touch.getX() / DISPLAY_SCALE;
    float touchY = touch.getY() / DISPLAY_SCALE;
    
    switch(mCurrentState) {
        case STATE_PREVIEW:
        
            // see if the camera icon has been tapped (touch coordinates are reversed for landscape mode)
            
            cameraButtonTargetPos.x += mCameraButtonTexture.getWidth() / 2.0f;
            cameraButtonTargetPos.y += mCameraButtonTexture.getHeight() / 2.0f;
            
            if( cameraButtonTargetPos.distance( Vec2f(touchX, touchY) ) < (mCameraButtonTexture.getWidth() * 2) ) {
               mCountDownStartTime = getElapsedSeconds();
               mCurrentState = STATE_COUNT_DOWN;
            }
        
        break;

        case STATE_COUNT_DOWN:
            // stub..
        break;
        
        case STATE_ACCEPT:
            
            if(touchY > 1280) { // only look for touches near the bottom of the screen.
                
                // just split the screen in half, no need to do precise hit detection for save/cancel buttons..
                if(touchX > width / 2){
                    
                    ip::flipVertical( &mCameraSurface );
                    cinder::cocoa::SafeUiImage img = cocoa::createUiImage( mCameraSurface );
                    
                    
                    // Call into objective C to do upload via cocoa
                    FileSender::sendFile(img);

                    
                    timeline().apply( &mPreviewTexturePos, Vec2f(0, -height ), 1.0f, EaseInCubic() );
                    
                }else{
                    timeline().apply( &mPreviewTexturePos, Vec2f(0, height ), 1.0f, EaseInBack() );
                }
                
                mCurrentState = STATE_PREVIEW;
                
                timeline().apply( &mDarkBgAlpha, 0.0f, 1.0f, EaseInCubic() );
                
                // Hide buttons
                timeline().apply( &mDiscardPos, Vec2f(100, height + 100 ), 1.0f, EaseInCubic() );
                timeline().apply( &mSavePos, Vec2f(width-700, height + 100 ), 1.0f, EaseInCubic() );
            }
        break;
    }
}
开发者ID:Instrument,项目名称:social-grid,代码行数:59,代码来源:PhotoBoothApp.cpp


示例16: update

void shaderExternalFileExampleApp::update(){
    if( mCapture && mCapture.checkNewFrame() ) {
		mTexture = gl::Texture( mCapture.getSurface() );
        mTexture.setWrap(GL_CLAMP, GL_CLAMP);
		mTexture.setMinFilter(GL_NEAREST);
		mTexture.setMagFilter(GL_NEAREST);
	}
}
开发者ID:JAGormley,项目名称:AoGP_Fall_2012,代码行数:8,代码来源:shaderExternalApp.cpp


示例17: update

/**
 here's where the magic happens
 all calculations are done in update
 **/
void millionParticlesApp::update()
{

    mFbo[mBufferIn].bindFramebuffer();

    //set viewport to fbo size
    gl::setMatricesWindow( mFbo[0].getSize(), false ); // false to prevent vertical flipping
    gl::setViewport( mFbo[0].getBounds() );

    GLenum buffer[3] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT };
    glDrawBuffers(3,buffer);

    mFbo[mBufferOut].bindTexture(0,0);
    mFbo[mBufferOut].bindTexture(1,1);
    mFbo[mBufferOut].bindTexture(2,2);

    mVelTex.bind(3);
    mPosTex.bind(4);
    mNoiseTex.bind(5);

    mVelShader.bind();
    mVelShader.uniform("positions",0);
    mVelShader.uniform("velocities",1);
    mVelShader.uniform("information",2);
    mVelShader.uniform("oVelocities",3);
    mVelShader.uniform("oPositions",4);
    mVelShader.uniform("noiseTex",5);

    glBegin(GL_QUADS);
    glTexCoord2f( 0.0f, 0.0f);
    glVertex2f( 0.0f, 0.0f);
    glTexCoord2f( 0.0f, 1.0f);
    glVertex2f( 0.0f, PARTICLES);
    glTexCoord2f( 1.0f, 1.0f);
    glVertex2f( PARTICLES, PARTICLES);
    glTexCoord2f( 1.0f, 0.0f);
    glVertex2f( PARTICLES, 0.0f);
    glEnd();

    mVelShader.unbind();

    mFbo[mBufferOut].unbindTexture();

    mVelTex.unbind();
    mPosTex.unbind();

    mFbo[mBufferIn].unbindFramebuffer();

    mBufferIn = (mBufferIn + 1) % 2;
    mBufferOut = (mBufferIn + 1) % 2;

    //for recording
    //    if (getElapsedFrames() == 600)
    //        exit(0);

}
开发者ID:ThomasLengeling,项目名称:millionParticles,代码行数:60,代码来源:millionParticlesApp.cpp


示例18: draw

void HexagonMirrorApp::draw()
{
    // clear the window
    gl::clear();

    // activate our camera
    gl::pushMatrices();
    gl::setMatrices( mCamera.getCamera() );

    // set render states
    gl::enable( GL_CULL_FACE );
    gl::enableDepthRead();
    gl::enableDepthWrite();
    gl::color( Color::white() );

    if( mVboMesh && mShaderInstanced && mBuffer )
    {
        // bind webcam image
        if( mWebcamTexture )
            mWebcamTexture.bind(0);

        // bind the shader, which will do all the hard work for us
        mShaderInstanced.bind();
        mShaderInstanced.uniform( "texture", 0 );
        mShaderInstanced.uniform( "scale", Vec2f( 1.0f / (3.0f * INSTANCES_PER_ROW), 1.0f / (3.0f * INSTANCES_PER_ROW) ) );

        // bind the buffer containing the model matrix for each instance,
        // this will allow us to pass this information as a vertex shader attribute.
        // See: initializeBuffer()
        glBindVertexArray(mVAO);

        // we do all positioning in the shader, and therefor we only need
        // a single draw call to render all instances.
        drawInstanced( mVboMesh, NUM_INSTANCES );

        // make sure our VBO is no longer bound
        mVboMesh.unbindBuffers();

        // unbind vertex array object containing our buffer
        glBindVertexArray(0);

        // unbind shader
        mShaderInstanced.unbind();

        if( mWebcamTexture )
            mWebcamTexture.unbind();
    }

    // reset render states
    gl::disableDepthWrite();
    gl::disableDepthRead();
    gl::disable( GL_CULL_FACE );

    // restore 2D drawing
    gl::popMatrices();
}
开发者ID:audionerd,项目名称:Cinder-Samples,代码行数:56,代码来源:HexagonMirrorApp.cpp


示例19: draw

void GeometryShaderApp::draw()
{
	// clear out the window 
	gl::clear( Color(0.95f, 0.95f, 0.95f) );

	// bind the shader and send the mesh to the GPU
	if(mShader && mVboMesh) {
		mShader.bind();
		mShader.uniform( "WIN_SCALE", Vec2f( getWindowSize() ) ); // casting to Vec2f is mandatory!
		mShader.uniform( "MITER_LIMIT", mLimit );
		mShader.uniform( "THICKNESS", mThickness );
		
		if(mTexture) {
			gl::enableAlphaBlending();
			gl::color( Color::white() );
			mTexture.enableAndBind();
		}
		else
			gl::color( Color::black() );

		gl::draw( mVboMesh );

		if(mTexture) {
			mTexture.unbind();
			gl::disableAlphaBlending();
		}

		if(mDrawWireframe) {
			gl::color( Color::black() );
			gl::enableWireframe();
			gl::draw( mVboMesh );
			gl::disableWireframe();
		}

		mShader.unbind();
	}

	// draw all points as red circles
	gl::color( Color(1, 0, 0) );

	std::vector<Vec2f>::const_iterator itr;
	for(itr=mPoints.begin();itr!=mPoints.end();++itr)
		gl::drawSolidCircle( *itr, mRadius );

	if( ! mPoints.empty() )
		gl::drawStrokedCircle( mPoints.back(), mRadius + 2.0f );

	// draw help
	if(mHelpTexture) {
		gl::color( Color::white() );
		gl::enableAlphaBlending();
		gl::draw( mHelpTexture );
		gl::disableAlphaBlending();
	}
}
开发者ID:meshula,项目名称:Cinder-Samples,代码行数:55,代码来源:GeometryShaderApp.cpp


示例20: draw

/**
 the draw method displays the last filled buffer
 **/
void millionParticlesApp::draw()
{
    gl::setMatricesWindow( getWindowSize() );
    gl::setViewport( getWindowBounds() );

    gl::clear( ColorA( 0.0f, 0.0f, 0.0f, 1.0f ) );

    gl::enableAlphaBlending();
    glDisable(GL_DEPTH_TEST);

    glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);

    mFbo[mBufferIn].bindTexture(0,0);
    mFbo[mBufferIn].bindTexture(1,1);
    mFbo[mBufferIn].bindTexture(2,2);

    mSpriteTex.bind(3);

    //Bewegungsshader
    mPosShader.bind();
    mPosShader.uniform("posTex",0);
    mPosShader.uniform("velTex",1);
    mPosShader.uniform("infTex",2);
    mPosShader.uniform("spriteTex",3);

    mPosShader.uniform("scale",(float)PARTICLES);

    gl::color(ColorA(1.0f,1.0f,1.0f,1.0f));
    //glTranslatef(Vec3f(getWindowWidth() / 4  - PARTICLES,0.0f,0.0f));
    gl::pushMatrices();

    glScalef(getWindowHeight() / (float)PARTICLES , getWindowHeight() / (float)PARTICLES ,1.0f);

    // draw particles
    gl::draw( mVbo );

    gl::popMatrices();

    mPosShader.unbind();

    mSpriteTex.unbind();

    mFbo[mBufferIn].unbindTexture();

    //    writeImage( "/Users/hacku/Desktop/img/1m/" + toString(getElapsedFrames()) + ".tif",   copyWindowSurface() );

    //	gl::color(Color(1,1,1));
    //	gl::setMatricesWindow( getWindowSize() );

    //drawText();

    gl::disableAlphaBlending();

}
开发者ID:ThomasLengeling,项目名称:millionParticles,代码行数:57,代码来源:millionParticlesApp.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ gl::TextureRef类代码示例发布时间:2022-05-31
下一篇:
C++ gl::State类代码示例发布时间: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