// main function, register functions to glut routine
int main(int argc, char** argv)
{
	atexit(OnShutdown);
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
	glutCreateWindow("GLUT PhysX3 Demo - Simple Box");

	glutDisplayFunc(OnRender);
	glutIdleFunc(OnIdle);
	glutReshapeFunc(OnReshape);

	glutMouseFunc(Mouse);
	glutKeyboardFunc(keypressed);
	glutMotionFunc(Motion);
	InitGL();
	InitializePhysX();

	glutMainLoop();

	return 0;
}
Beispiel #2
0
	printf("\n");
}

void Game::InitializeGame()
{
	InitializeRootResourcesAndPlugins();
	//Manually set the Rendering System
	Ogre::RenderSystem *rs = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
	rs->setConfigOption("Full Screen","No");
	rs->setConfigOption("Video Mode","1024 x 768 @ 32-bit colour");
	rs->setConfigOption("FSAA","16");
	rs->setConfigOption("Fixed Pipeline Enabled","Yes");
	rs->setConfigOption("RTT Preferred Mode","FBO");
	rs->setConfigOption("VSync","Yes");
	rs->setConfigOption("sRGB Gamma Conversion","No");

	mRoot->setRenderSystem(rs);

	CreateOgreWindow("Probending");
	///https://github.com/oysteinkrog/gpusphsim/tree/master/SPHSimOgreApp
	// Set default mipmap level (note: some APIs ignore this)
	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	InitializeOIS(true);
Beispiel #3
0
bool GraphicsClass::Initialize(int& screen_width, int& screen_height, HWND hwnd, NxScene* scene)
{
	bool result;

	result = InitializePhysX(scene);
	if(!result) return false;

	// Create D3D object
	m_D3D = new D3DClass;
	if(!m_D3D)
	{
		return false;
	}

	//initialize D3D object
	result = m_D3D->Initialize(screen_width, screen_height, true, hwnd, \
		FULL_SCREEN, SCREEN_DEPTH, SCREEN_NEAR);
	if(!result)
	{
		MessageBox(hwnd, L"Couldn't initialize D3D", L"Error", MB_OK);
		return false;
	}

	// Create the camera object.
	m_Camera = new CameraClass;
	if(!m_Camera)
	{
		return false;
	}

	// Set the initial position of the camera.
	m_Camera->SetPosition(0.0f, 5.0f, -20.0f);
	

	// Initialize the model object.
	
	if(!result)
	{
		MessageBox(hwnd, L"Could not initialize the model object.", L"Error", MB_OK);
		return false;
	}

	// Create the color shader object.
	m_baseShader = new BaseShaderClass;
	if(!m_baseShader)
	{
		return false;
	}

	m_light = new LightClass;
	if(!m_light)
	{
		return false;
	}

	// Initialize the color shader object.
	result = m_baseShader->Initialize(m_D3D->GetDevice(), hwnd);
	if(!result)
	{
		MessageBox(hwnd, L"Could not initialize the shader object.", L"Error", MB_OK);
		return false;
	}

	// Initialize the light object.
	m_light->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);
	m_light->SetDirection(-1.0f, 1.0f, 1.0f);

	return true;
}