Пример #1
0
// Receives Color data
void MeshApp::onColorData( Surface8u surface, const DeviceOptions& deviceOptions )
{
	if ( mTextureColor ) {
		mTextureColor.update( surface, surface.getBounds() );
	} else {
		mTextureColor = gl::Texture( surface );
		mTextureColor.setWrap( GL_REPEAT, GL_REPEAT );
	}
}
Пример #2
0
void BulletTestApp::setup()
{
	mDragging	= false;
	mFrameRate	= 0.0f;
	mTest		= 9;
	mTestPrev	= mTest;

	// Set up lighting
	mLight = new gl::Light( gl::Light::DIRECTIONAL, 0 );
	mLight->setDirection( Vec3f( 0.0f, 0.1f, 0.3f ).normalized() );
	mLight->setAmbient( ColorAf( 0.2f, 0.2f, 0.2f, 1.0f ) );
	mLight->setDiffuse( ColorAf( 1.0f, 1.0f, 1.0f, 1.0f ) );
	mLight->enable();

	// Load meshes
	loadModels();

	// Create a Bullet dynamics world
	mWorld = bullet::createWorld();

	// Load texture
	mTexSquare	= gl::Texture( loadImage( loadResource( RES_TEX_SQUARE ) ) );
	mTexSphere	= gl::Texture( loadImage( loadResource( RES_TEX_SPHERE ) ) );
	mTexTerrain	= gl::Texture( loadImage( loadResource( RES_TEX_TERRAIN ) ) );
	mTexTerrain.setWrap( GL_REPEAT, GL_REPEAT );
	mTexTerrain.unbind();

	// Init terrain pointer
	mTerrain = 0;

	// Parameters
	mParams = params::InterfaceGl( "Params", Vec2i( 200, 120 ) );
	mParams.addParam( "Frame Rate",		&mFrameRate,								"", true );
	mParams.addParam( "Test",			&mTest,										"min=0 max=9 step=1 keyDecr=t keyIncr=T" ); 
	mParams.addButton( "Drop",			bind( &BulletTestApp::drop, this ),			"key=space" );
	mParams.addButton( "Screen shot",	bind( &BulletTestApp::screenShot, this ),	"key=s" );
	mParams.addButton( "Quit",			bind( &BulletTestApp::quit, this ),			"key=q" );

	// Initialize
	initTest();

	// Run first resize to initialize view
	resize( ResizeEvent( getWindowSize() ) );

}
Пример #3
0
void BulletTestApp::setup()
{

	// Set test mode
	mTest = 0;
	mTestPrev = mTest;

	// Set up lighting
	mLight = new gl::Light( gl::Light::DIRECTIONAL, 0 );
	mLight->setDirection( Vec3f( 0.0f, 0.1f, 0.3f ).normalized() );
	mLight->setAmbient( ColorAf( 0.2f, 0.2f, 0.2f, 1.0f ) );
	mLight->setDiffuse( ColorAf( 1.0f, 1.0f, 1.0f, 1.0f ) );
	mLight->enable();

	// Load meshes
	loadModels();

	// Create a Bullet dynamics world
	mWorld = bullet::createWorld();

	// Load texture
	mTexSquare = gl::Texture( loadImage( loadResource( RES_TEX_SQUARE ) ) );
	mTexSphere = gl::Texture( loadImage( loadResource( RES_TEX_SPHERE ) ) );
	mTexTerrain = gl::Texture( loadImage( loadResource( RES_TEX_TERRAIN ) ) );
	mTexTerrain.setWrap( GL_REPEAT, GL_REPEAT );
	mTexTerrain.unbind();

	// Init terrain pointer
	mTerrain = 0;

	// Parameters
	mFrameRate = 0.0f;
	mParams = params::InterfaceGl( "Params", Vec2i( 150, 100) );
	mParams.addParam( "Frame Rate", &mFrameRate, "", true );
	mParams.addParam( "Test", &mTest, "min=0 max=7 step=1 keyDecr=d keyIncr=D" ); 

	// Initialize
	initTest();

	// Run first resize to initialize view
	resize( ResizeEvent( getWindowSize() ) );

}