コード例 #1
0
int main(int argc, char* argv[])
{
	SimpleOpenGL3App* app = new SimpleOpenGL3App("Standalone Example (Software Renderer, TinyRenderer)", 1024, 768, true);
	int textureWidth = 640;
	int textureHeight = 480;

	SW_And_OpenGLGuiHelper gui(app, false, textureWidth, textureHeight, app->m_primRenderer);

	CommonExampleOptions options(&gui);
	CommonExampleInterface* example = StandaloneExampleCreateFunc(options);

	example->initPhysics();
	example->resetCamera();
	do
	{
		app->m_instancingRenderer->init();
		app->m_instancingRenderer->updateCamera(app->getUpAxis());

		example->stepSimulation(1. / 60.);

		example->renderScene();

		DrawGridData dg;
		dg.upAxis = app->getUpAxis();
		app->drawGrid(dg);
		app->swapBuffer();
	} while (!app->m_window->requestedExit());

	example->exitPhysics();
	delete example;
	delete app;
	return 0;
}
コード例 #2
0
int main(int argc, char* argv[])
{
	
	TinyRendererGUIHelper noGfx(640,480);

	CommonExampleOptions options(&noGfx);
	CommonExampleInterface*    example = StandaloneExampleCreateFunc(options);
	
	example->initPhysics();
	example->resetCamera();

	for (int i=0;i<1000;i++)
	{
		printf("Simulating step %d\n",i);
		example->stepSimulation(1.f/60.f);
		example->renderScene();
	}
	example->exitPhysics();

	delete example;

	return 0;
}