Example #1
0
////////////////////////////////Main Function//////////////////////////////////////////
int main(int argc, char* argv[])
{
	Timer t;

	glutInit(&argc,argv);
	glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH | GLUT_MULTISAMPLE);
	glutInitWindowPosition(SCREEN_WIDTH/8,SCREEN_HEIGHT/8);
	glutInitWindowSize(3*SCREEN_WIDTH/4,3*SCREEN_HEIGHT/4);
	glutCreateWindow(argv[0]);

	init();

	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutKeyboardFunc(getkey);
	glutMouseFunc(Mouse);
	glutMotionFunc(MouseMotion);
	glutIdleFunc(idle);

	glCheckError("main");
	printf("Total time used for loading scene is: %f\n",t.elapsed_time());
	// Initialize physics scene and start the application main loop if scene was created
	if (InitNx())
	{
		atexit(ExitNx);
		glutMainLoop();
	}
	return 0;
}
Example #2
0
int main(int argc, char** argv)
{
	PrintControls();
    InitGlut(argc, argv, "Lesson 703: Brakes and Steering");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #3
0
int main(int argc, char** argv)
{
	PrintControls();
    InitGlut(argc, argv);
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #4
0
int main(int argc, char** argv)
{
	PrintControls();
	InitGlut(argc, argv, "Lesson 211: 6DOF Joint Limits, Springs");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #5
0
int main(int argc, char** argv)
{
	PrintControls();
    InitGlut(argc, argv, "Lesson 702: Suspension and Torque");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #6
0
int main(int argc, char** argv)
{
	PrintControls();
	InitGlut(argc, argv, "Lesson 213: 6DOF Motion Controller");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #7
0
int main(int argc, char** argv)
{
	PrintControls();
	InitGlut(argc, argv, "Lesson 408: Fragmenting Objects");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #8
0
int main(int argc, char** argv)
{
	PrintControls();
	InitGlut(argc, argv, "Lesson 216: 6DOF Angular Driver");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #9
0
int main(int argc, char** argv)
{
	PrintControls();
    InitGlut(argc, argv, "Lesson 801: Hardware Scene Manager");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #10
0
int main(int argc, char** argv)
{
	PrintControls();
	InitGlut(argc, argv, "Lesson 1006: Tearing");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #11
0
int main(int argc, char** argv)
{
	PrintControls();
	InitGlut(argc, argv, "Lesson 904: Fluid and Drain");
	InitNx();
	glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #12
0
int main(int argc, char** argv)
{
	PrintControls();
	InitGlut(argc, argv, "Lesson 503: Core Dump");
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #13
0
int main(int argc, char** argv)
{
	PrintControls();
	InitGlut(argc, argv, "Lesson 405: Grass");
	NewLight();
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #14
0
void KeyboardUpCallback(unsigned char key, int x, int y)
{
	gKeys[key] = false;

	switch (key)
	{
	    case '0': { gPerfRenderer.toggleEnable(); break; }
		case 'p': { bPause = !bPause; 
					if (bPause)
						hud.SetDisplayString(1, "Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
					else
						hud.SetDisplayString(1, "", 0.0f, 0.0f);	
					getElapsedTime(); 
					break; }
		case 'x': { bShadows = !bShadows; break; }
		case 'b': { bDebugWireframeMode = !bDebugWireframeMode; break; }		
		case 'f': { bForceMode = !bForceMode; break; }
		case 27 : { exit(0); break; }

		// Switch simulation threads mode
		case 't': {	ReleaseNx();
					gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
					gbThreadScheduler = true;
					InitNx();
					break; }
		case 'y': {	ReleaseNx();
					gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
					gbThreadPolling = true;
					InitNx();
					break; }
		case 'g': {	ReleaseNx();
					gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
					gbThreadSDKManage = true;
					InitNx();
					break; }
		case 'h': {	ReleaseNx();
					gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
					gbNoThread = true;
					InitNx();
					break; }
		default : { break; }
	}
}
Example #15
0
int main(int argc, char** argv)
{
	gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
	gbThreadScheduler = true;
	PrintControls();
    InitGlut(argc, argv);
    InitNx();
    glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #16
0
int main(int argc, char** argv)
{
	InitWin7();
	InitDevIL();
	InitRun(argc,argv);
	InitGlut(argc, argv);
	if (bFreshRun)
		InitNx();
	else
		ReInitNx();
	glutMainLoop();
	ReleaseNx();
	return 0;
}
Example #17
0
int main(int argc, char** argv)
{
	//physx
	InitNx();
	//osg
	osgViewer::Viewer viewer;
	viewer.setSceneData( createScene());
	viewer.getCamera()->setClearColor(osg::Vec4( 0.3, 0.4, 0.5, 1. ) );

	viewer.addEventHandler(new Handler);
	viewer.run();

	gMyPhysX.exitPhysX();

	return 0;

}
Example #18
0
void ResetNx()
{
	LetGo();
	ReleaseNx();
	InitNx();
}
Example #19
0
void ResetNx()
{
	ReleaseNx();
	bHWScene = true;
	InitNx();
}
int main(int argc, char** argv)
	{
	// Initialize Glut
#ifdef __PPCGEKKO__
	printf("Press 1,2,+,-,a,HOME to drop boxes. Press b to shoot a box.\nArrows camera.\n");
#else
	printf("Press 1-6 to drop boxes. Press w to shoot a box.\nArrows and mouse move camera.\n");
	printf("Press p to pause the simulation.\n");
#endif

#if defined(_XBOX) || defined(__CELLOS_LV2__)
	glutRemapButtonExt(0, 'w', false); // A/X to shoot box
	glutRemapButtonExt(1, '1', false); // B/O, X/S, Y/T shifted/unshifted to drop boxes
	glutRemapButtonExt(2, '2', false);
	glutRemapButtonExt(3, '3', false);
	glutRemapButtonExt(1, '4', true);
	glutRemapButtonExt(2, '5', true);
	glutRemapButtonExt(3, '6', true);
#endif

#ifdef __PPCGEKKO__	
	glutRemapButtonExt('a','1');
	glutRemapButtonExt('b','w');
	glutRemapButtonExt('1','2');
	glutRemapButtonExt('2','3');
	glutRemapButtonExt('+','4');
	glutRemapButtonExt('-','5');
	glutRemapButtonExt(GLUT_KEY_HOME,'6');
	glutRemapButtonExt(GLUT_KEY_UP,101);
	glutRemapButtonExt(GLUT_KEY_DOWN,103);
	glutRemapButtonExt(GLUT_KEY_LEFT,100);
	glutRemapButtonExt(GLUT_KEY_RIGHT,102);
#endif

	glutInit(&argc, argv);
	glutInitWindowSize(512, 512);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	gMainHandle = glutCreateWindow("SampleMaterials");
	glutSetWindow(gMainHandle);
	glutDisplayFunc(RenderCallback);
	glutReshapeFunc(ReshapeCallback);
	glutIdleFunc(IdleCallback);
	glutKeyboardFunc(KeyboardCallback);
	glutSpecialFunc(ArrowKeyCallback);
	glutMouseFunc(MouseCallback);
	glutMotionFunc(MotionCallback);
	MotionCallback(0,0);
	
	atexit(ExitCallback);
	
	// Setup default render states
	glClearColor(0.3f, 0.4f, 0.5f, 1.0);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_COLOR_MATERIAL);
	glEnable(GL_CULL_FACE);
	
	// Setup lighting
	glEnable(GL_LIGHTING);
	float AmbientColor[]	= { 0.0f, 0.1f, 0.2f, 0.0f };		glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientColor);
	float DiffuseColor[]	= { 1.0f, 1.0f, 1.0f, 0.0f };		glLightfv(GL_LIGHT0, GL_DIFFUSE, DiffuseColor);
	float SpecularColor[]	= { 0.0f, 0.0f, 0.0f, 0.0f };		glLightfv(GL_LIGHT0, GL_SPECULAR, SpecularColor);
	float Position[]		= { 100.0f, 100.0f, 400.0f, 1.0f };		glLightfv(GL_LIGHT0, GL_POSITION, Position);
	glEnable(GL_LIGHT0);

	// Initialize physics scene and start the application main loop if scene was created
	if (InitNx())
		glutMainLoop();

	return 0;
	}
Example #21
0
void ResetNx()
{
	ExitNx();
	if (!InitNx()) exit(0);
}
int main(int argc, char** argv)
{
#ifdef __PPCGEKKO__
	printf("Press the keys 1,2,+,-, and b to create various things.\nThe object will appear in randomly in one of two scenes.\n");
	printf("Use the arrow keys to move around.\n");
	printf("Press a to pause the simulation.\n");
#else
	printf("Press the keys w,space,s,b, and t to create various things.\nThe object will appear in randomly in one of two scenes.\n");
	printf("Use the arrow keys or 2, 4, 6 and 8 or d, f, e and g to move around.\nUse the mouse to look around.\n");
	printf("Press p to pause the simulation.\n");
#endif	
	// Initialize Glut
	glutInit(&argc, argv);
	glutInitWindowSize(512, 512);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	gMainHandle = glutCreateWindow("SampleMultipleScenes");
	glutSetWindow(gMainHandle);
	glutDisplayFunc(RenderCallback);
	glutReshapeFunc(ReshapeCallback);
	glutIdleFunc(IdleCallback);
	glutKeyboardFunc(KeyboardCallback);
	glutSpecialFunc(ArrowKeyCallback);
	glutMouseFunc(MouseCallback);
	glutMotionFunc(MotionCallback);
	MotionCallback(0,0);

	atexit(ExitCallback);

#ifdef __PPCGEKKO__	
	glutRemapButtonExt('a','p');
	glutRemapButtonExt('b','w');
	glutRemapButtonExt('1','s');
	glutRemapButtonExt('2','b');
	glutRemapButtonExt('+','t');
	glutRemapButtonExt('-',' ');
	glutRemapButtonExt(GLUT_KEY_UP,'8');
	glutRemapButtonExt(GLUT_KEY_DOWN,'2');
	glutRemapButtonExt(GLUT_KEY_LEFT,'4');
	glutRemapButtonExt(GLUT_KEY_RIGHT,'6');
#endif

	// Setup default render states
	glClearColor(0.5f, 0.4f, 0.5f, 1.0);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_COLOR_MATERIAL);
	glEnable(GL_CULL_FACE);

	// Setup lighting
	glEnable(GL_LIGHTING);
	float AmbientColor[]	= { 0.1f, 0.1f, 0.1f, 0.0f };		glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientColor);
	float DiffuseColor[]	= { 1.0f, 1.0f, 1.0f, 0.0f };		glLightfv(GL_LIGHT0, GL_DIFFUSE, DiffuseColor);
	float SpecularColor[]	= { 0.0f, 0.0f, 0.0f, 0.0f };		glLightfv(GL_LIGHT0, GL_SPECULAR, SpecularColor);
	float Position[]		= { 0.0f, 10.0f, 40.0f, 1.0f };		glLightfv(GL_LIGHT0, GL_POSITION, Position);
	glEnable(GL_LIGHT0);

	// Initialize physics scene and start the application main loop if scene was created
	if (InitNx())
		glutMainLoop();

	return 0;
}
Example #23
0
void ResetNx()
{
	ReleaseNx();
	InitNx();
}