Exemple #1
0
int main(int argc, char* argv[])
{


#ifdef __APPLE__
	MacOpenGLWindow* window = new MacOpenGLWindow();
#else
	Win32OpenGLWindow* window = new Win32OpenGLWindow();
#endif
	btgWindowConstructionInfo wci(g_OpenGLWidth,g_OpenGLHeight);
	wci.m_openglVersion = 2;	
	window->createWindow(wci);
	window->setWindowTitle("MyTest");
#ifdef _WIN32
	glewInit();
#endif

    
	window->startRendering();
	float color[4] = {1,1,1,1};
//	prim.drawRect(0,0,200,200,color);
	
    
	
	window->endRendering();

    
	
	window->setKeyboardCallback(MyKeyboardCallback);


	{
		BasicDemo* demo = new BasicDemo;
		demo->myinit();
		demo->initPhysics();
		
		do
		{
			window->startRendering();
			demo->clientMoveAndDisplay();

			render.init();
			render.renderPhysicsWorld(demo->getDynamicsWorld());
			window->endRendering();
		} while (!window->requestedExit());

		demo->exitPhysics();
		delete demo;
	}


	window->closeWindow();
	delete window;

	return 0;
}
Exemple #2
0
int main(int argc, char* argv[])
{
	
	float dt = 1./120.f;
#ifdef BT_DEBUG
	char* name = "Bullet 2 CPU FeatherstoneMultiBodyDemo (Debug build=SLOW)";
#else
	char* name = "Bullet 2 CPU FeatherstoneMultiBodyDemo";
#endif

	
	SimpleOpenGL3App* app = new SimpleOpenGL3App(name,1024,768);
	app->m_instancingRenderer->setCameraDistance(40);
	app->m_instancingRenderer->setCameraPitch(0);
	app->m_instancingRenderer->setCameraTargetPosition(b3MakeVector3(0,0,0));

	app->m_window->setMouseMoveCallback(MyMouseMoveCallback);
	app->m_window->setMouseButtonCallback(MyMouseButtonCallback);

	BasicDemo* demo = new BasicDemo(app);
	demo->initPhysics();
	sDemo = demo;

	GLint err = glGetError();
    assert(err==GL_NO_ERROR);
	
	do
	{
		GLint err = glGetError();
		assert(err==GL_NO_ERROR);
		app->m_instancingRenderer->init();
		app->m_instancingRenderer->updateCamera();
		
		demo->stepSimulation();
		demo->drawObjects();
		app->drawGrid(10,0.01);
		char bla[1024];
		static int frameCount = 0;
		frameCount++;
		sprintf(bla,"Simulation frame %d", frameCount);
		
		app->drawText(bla,10,10);
		app->swapBuffer();
	} while (!app->m_window->requestedExit());


	demo->exitPhysics();
	delete demo;

	delete app;
	return 0;
}
Exemple #3
0
int main(int argc,char** argv)
{

	BasicDemo ccdDemo;
	ccdDemo.initPhysics();

	int i;
	for (i=0;i<5;i++)
		ccdDemo.clientMoveAndDisplay();
	ccdDemo.exitPhysics();
	
	return 0;
}
Exemple #4
0
int main(int argc,char** argv)
{
	GLDebugDrawer	gDebugDrawer;

	///testing the btHashMap	
	btHashMap<btHashKey<OurValue>,OurValue> map;
	
	OurValue value1(btVector3(2,3,4));
	btHashKey<OurValue> key1(value1.getUid());
	map.insert(key1,value1);


	OurValue value2(btVector3(5,6,7));
	btHashKey<OurValue> key2(value2.getUid());
	map.insert(key2,value2);
	

	{
		OurValue value3(btVector3(7,8,9));
		btHashKey<OurValue> key3(value3.getUid());
		map.insert(key3,value3);
	}


	map.remove(key2);

	const OurValue* ourPtr = map.find(key1);
	for (int i=0;i<map.size();i++)
	{
		OurValue* tmp = map.getAtIndex(i);
		//printf("tmp value=%f,%f,%f\n",tmp->m_position.getX(),tmp->m_position.getY(),tmp->m_position.getZ());
	}
	
	BasicDemo ccdDemo;
	ccdDemo.initPhysics();
	ccdDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);


#ifdef CHECK_MEMORY_LEAKS
	ccdDemo.exitPhysics();
#else
	return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",&ccdDemo);
#endif
	
	//default glut doesn't return from mainloop
	return 0;
}