Beispiel #1
0
// Render
void MeshApp::draw()
{

	// Set up window
	gl::clear( ColorAf::black(), true );
	gl::setMatrices( mCamera );
	gl::color( ColorAf::white() );

	// Check texture and VBO
	if ( mTextureDepth && mTextureColor && mVboMesh ) {

		// Position world
		gl::pushMatrices();
		gl::scale( -1.0f, -1.0f, -1.0f );
		gl::rotate( mRotation );

		// Bind textures
		mTextureDepth.bind( 0 );
		mTextureColor.bind( 1 );
		
		// Bind and configure shader
		mShader.bind();
		mShader.uniform( "brightTolerance",	mBrightTolerance 						);
		mShader.uniform( "eyePoint",		mEyePoint 								);
		mShader.uniform( "lightAmbient",	mLightAmbient 							);
		mShader.uniform( "lightDiffuse",	mLightDiffuse 							);
		mShader.uniform( "lightPosition",	mLightPosition 							);
		mShader.uniform( "lightSpecular",	mLightSpecular 							);
		mShader.uniform( "positions",		0 										);
		mShader.uniform( "scale",			mScale 									);
		mShader.uniform( "showColor",		mShowColor 								);
		mShader.uniform( "shininess",		mLightShininess 						);
		mShader.uniform( "Color",			1 										);
		mShader.uniform( "ColorOffset",		Vec2f( mColorOffsetX, mColorOffsetY )	);
		mShader.uniform( "uvmix",			mMeshUvMix								);

		// Draw VBO
		gl::draw( mVboMesh );

		// Stop drawing
		mShader.unbind();
		mTextureDepth.unbind();
		mTextureColor.unbind();
		gl::popMatrices();

	}

	// Draw params
	params::InterfaceGl::draw();

}
void BulletTestApp::bindTexture( uint32_t index )
{
	if ( mTest > 4 ) {
		if ( index == 0 ) {
			mTexTerrain.bind();
		} else {
			if ( mTest < 7 ) {
				mTexSphere.bind();
			}
		}
	} else {
		if ( ( ( mTest == 0 || mTest == 3 ) && index > 0 ) || mTest == 1 ) {
			mTexSquare.bind();
		}
	}
}
void Fluid2DTextureApp::draw()
{
	// clear out the window with black
	gl::clear( Color( 0, 0, 0 ) ); 
	gl::setMatricesWindow( getWindowWidth(), getWindowHeight() );

	// Update the positions and tex coords
	Rectf drawRect = getWindowBounds();
	int limX = mFluid2D.resX() - 1;
	int limY = mFluid2D.resY() - 1;
	float dx = drawRect.getWidth()/(float)limX;
	float dy = drawRect.getHeight()/(float)limY;
	
	for( int j = 0; j < mFluid2D.resY(); ++j ) {
		for( int i = 0; i < mFluid2D.resX(); ++i ) {
			Vec2f P = Vec2f( i*dx, j*dy );
			Vec2f uv = mFluid2D.texCoordAt( i, j );

			int idx = j*mFluid2D.resX() + i;
			mTriMesh.getVertices()[idx] = P;
			mTriMesh.getTexCoords()[idx] = uv;
			
		}
	}

	mTex.bind();
	gl::draw( mTriMesh ); 
	mTex.unbind();
	
	mParams.draw();	
}
Beispiel #4
0
void Pumpkin::drawPumpkin(const ci::gl::Texture & PumpkinTexture)
{
  PumpkinTexture.bind();
  ci::gl::translate(mPos);
  ci::gl::rotate(ci::Vec3f(180.f, 0.f, 0.f));
  ci::gl::drawCube(ci::Vec3f(ci::Vec3f::zero()), mSize);
  PumpkinTexture.unbind();
}
void TownwindowHit::drawTownwindow(const ci::gl::Texture& mTownwindowTexture)
{
  mTownwindowTexture.bind();
  ci::gl::translate(mPos);
  ci::gl::rotate(ci::Vec3f(180.f, 0.f, 0.f));
  ci::gl::drawCube(ci::Vec3f(ci::Vec3f::zero()), mSize);
  mTownwindowTexture.unbind();
}
Beispiel #6
0
void King2::drawKing2(const ci::gl::Texture& texture)
{
  texture.bind();
  ci::gl::translate(mPos);
  ci::gl::rotate(mRotate);
  ci::gl::drawCube(ci::Vec3f(ci::Vec3f::zero()), mSize);
  texture.unbind();
}
Beispiel #7
0
void BulletTestApp::bindTexture( TextureType type )
{
    switch( type )
    {
    case TT_GROUND     :
        mTexGround.bind();
        break;
    case TT_BACKBOARD  :
        mTexBackBoard.bind();
        break;
    case TT_RING       :
        mTexRing.bind();
        break;
    case TT_BASKETBALL :
        mTexBasketBall.bind();
        break;
    }
}
void _TBOX_PREFIX_App::draw()
{
	gl::clear( Color( 0.2f, 0.2f, 0.3f ) );
	gl::enableDepthRead();
	
	mTex.bind();
	gl::setMatrices( mCam );
	glPushMatrix();
		gl::multModelView( mCubeRotation );
		gl::drawCube( Vec3f::zero(), Vec3f( 2.0f, 2.0f, 2.0f ) );
	glPopMatrix();
}
Beispiel #9
0
void Cinderella::drawCinderella(const ci::gl::Texture & texture, const ci::Vec3f& offset)
{
  ci::gl::pushModelView();
  
  texture.bind();
  ci::gl::translate(mPos);
  ci::gl::rotate(mRotate);
  ci::gl::translate(offset);
  ci::gl::drawCube(ci::Vec3f(ci::Vec3f::zero()), mSize);
  texture.unbind();
  
  ci::gl::popModelView();
}
void LocationOrbitalOverlay::draw()
{

	const ci::gl::Texture fbotex = mFbo->getTexture();
	
	gl::enableAdditiveBlending(); 
	
	mShader->bind();
	
	fbotex.bind(0); 
	mSphereAlpha->getTexture()->bind(1);

	mShader->uniform("mapTexture", 0);
	mShader->uniform("alphaTexture", 1);

	drawQuad();
	
	fbotex.unbind(0);
	mSphereAlpha->getTexture()->unbind(1);

	mShader->unbind();

	gl::enableAlphaBlending(); 
}
void VboMeshSampleApp::draw()
{
	// Set up window
	gl::setViewport( getWindowBounds() );
	gl::setMatrices( mCamera );
	gl::clear( ColorAf::gray( 0.6f ) );

	// Use arcball to rotate model view
	glMultMatrixf( mArcball.getQuat() );

	// Enabled lighting, texture mapping, wireframe
	if ( mLightEnabled ) {
		gl::enable( GL_LIGHTING );
	}
	if ( mTextureEnabled && mTexture ) {
		gl::enable( GL_TEXTURE_2D );
		mTexture.bind();
	}
	if ( mWireframe ) {
		gl::enableWireframe();
	}

	// Apply scale
	gl::pushMatrices();
	gl::scale( mScale );
	
	// Draw selected mesh
	switch ( (MeshType)mMeshIndex ) {
	case MESH_TYPE_CIRCLE:
		gl::draw( mCircle );
		break;
	case MESH_TYPE_CONE:
		gl::draw( mCone );
		break;
	case MESH_TYPE_CUBE:
		gl::draw( mCube );
		break;
	case MESH_TYPE_CUSTOM:
		gl::draw( mCustom );
		break;
	case MESH_TYPE_CYLINDER:
		gl::draw( mCylinder );
		break;
	case MESH_TYPE_RING:
		gl::draw( mRing );
		break;
	case MESH_TYPE_SPHERE:
		gl::draw( mSphere );
		break;
	case MESH_TYPE_SQUARE:
		gl::draw( mSquare );
		break;
	}
	
	// End scale
	gl::popMatrices();

	// Disable wireframe, texture mapping, lighting
	if ( mWireframe ) {
		gl::disableWireframe();
	}
	if ( mTextureEnabled && mTexture ) {
		mTexture.unbind();
		gl::disable( GL_TEXTURE_2D );
	}
	if ( mLightEnabled ) {
		gl::disable( GL_LIGHTING );
	}

	// Draw params GUI
	mParams.draw();
}