//Load all the textures we need.
	void Graphics::LoadAssets()
	{
		//Create the vertex buffer used for sprites
		InitGeometry();

		//Load the textures
    LoadTexture("Assets/Default.png");
    LoadTexture("Assets/Bullet.png");
    //LoadTexture("Assets/Bomb.png");
		LoadTexture("Assets/Circle.png");
		LoadTexture("Assets/Square.png");
		LoadTexture("Assets/CircleOutline.png");
		LoadTexture("Assets/SquareOutline.png");
		LoadTexture("Assets/Ship_template.png");
		LoadTexture("Assets/HBarrier.png");
    LoadTexture("Assets/StillBackground.png");

		//Load the shaders

    LOAD_EFFECT( Basic,       NULL );
    LOAD_EFFECT( DebugShader, NULL );
    LOAD_EFFECT( Water,       new WaterShader() );
    LOAD_EFFECT( Bullet,      NULL );
    LOAD_EFFECT( Menu,        NULL );
	}
Beispiel #2
0
//-----------------------------------------------------------------------------
// Name: MsgProc()
// Desc: The window's message handler
//-----------------------------------------------------------------------------
LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    switch( msg )
    {
        case WM_DESTROY:
            PostQuitMessage( 0 );
            return 0;

        case WM_TIMER:
        case WM_PAINT:
            Render();       // Update the main window when needed
            break;

        // If the display mode changes, tear down the graph and rebuild it.
        // The resolution may have changed or we may have lost surfaces due to
        // a transition from another application's full screen exclusive mode.
        case WM_DISPLAYCHANGE:
            Cleanup();
            InitD3D(hWnd);
            InitGeometry();
            break;

        case WM_CHAR:
        {
            // Close the app if the ESC key is pressed
            if (wParam == VK_ESCAPE)
            {
                PostMessage(hWnd, WM_CLOSE, 0, 0);
            }
            // else maybe background color change by space
            else if(wParam == VK_SPACE)
            {
                bkRed = (BYTE)(rand()%0xFF);
                bkGrn = (BYTE)(rand()%0xFF);
                bkBlu = (BYTE)(rand()%0xFF);
            }
            // else if 'enter' return to black
            else if(wParam == VK_RETURN )
            {
                bkRed = bkGrn = bkBlu = 0x0;
            }
        }
        break;

        case WM_SYSCOMMAND:
        {
            switch (wParam)
            {
                case ID_HELP_ABOUT:
                    // Create a modeless dialog to prevent rendering interruptions
                    CreateDialog(hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, 
                                (DLGPROC) AboutDlgProc);
                    return 0;
            }
        }
        break;
    }

    return DefWindowProc( hWnd, msg, wParam, lParam );
}
Beispiel #3
0
HRESULT Init(HWND hWnd)
{
	mod_file_system.Init("Core.FileSystem.dll");
	mod_dx9.Init("Engine.Graphics.DX9.dll");

	mod_file_system.CreateInstance(CLSID_CFileSystem, UUID_PPV(IFileSystem, &pFS));
	gEnv = &sgEnv;
	gEnv->Core = 0;
	gEnv->Logger = 0;
	gEnv->PluginManager = 0;
	gEnv->FileSystem = pFS;

	IPlugin *plug;
	mod_dx9.CreateInstance(UUID_PPV(IPlugin, &plug));
	plug->Initialize(gEnv, 0);
	plug->Release();

	mod_dx9.CreateInstance(UUID_PPV(IRenderer, &pRenderer));

	SRendererParams params;
	params.FullScreen = fullScreen;
	params.MainWindow = (WND_HANDLE)hWnd;
	params.ScreenHeight = iHeight;
	params.ScreenWidth = iWidth;
	params.BackBufferFormat = FMT_X8R8G8B8;
	pRenderer->Init(params);

	return InitGeometry();
}
Beispiel #4
0
int SDLWin::Run()
{
	WM->CreateSDLWindow();										// Initialize SDL
	WM->InitOpenGL();											// Initialize OpenGL
	Game->InitResources();
	Game->Pause();												// Switch to Menu Mode
	WM->GetRenderer()->Init();									// Initialize Renderer
	InitGeometry();												// Create Menus
	InitTextures();												// Initialize Menu Textures
	WM->GetRenderer()->To2D();									// Switch to 2D Rendering

    SDL_Event Event;											// Create an event variable for catching events that SDL sends
    while(WM->IsRunning())									// Main Loop starts here
    {
        if(SDL_PollEvent(&Event)) {
			GEM->ProcessEvent(&Event);				// Send Events to the 'Events' function for processing
        }
		if(WM->IsActive())
		{
			Loop();						// Game loop processing
			Render();					// Draw to the screen
			_CrtCheckMemory( );
		}
		SDL_Delay(TimeLeft());			// Limit the frame rate
    }

    Cleanup();							// Once everything is done, make sure to clean up all loose ends
    return 1;							// Return 1 so that we know everything went fine
}
Beispiel #5
0
CEasyGenView::CEasyGenView()
{
	// OpenGL
	m_hGLContext   = NULL;
	m_GLPixelIndex = 0;

	// Mouse
//	m_CursorRotation = AfxGetApp()->LoadCursor(IDC_CURSOR_ROTATION);

	m_ClearColorRed   = (float)GetRValue(g_Prefs.m_BgColor) / 255.f;
	m_ClearColorGreen = (float)GetGValue(g_Prefs.m_BgColor) / 255.f;
	m_ClearColorBlue  = (float)GetBValue(g_Prefs.m_BgColor) / 255.f;

	m_RenderMode = R_FLAT | R_FL_QUADFRAME;

	m_ViewCulling    = TRUE;
	m_ViewShadeModel = GL_SMOOTH;

	m_VertexGot = -1;

	m_Md3Highlight = 0;

	m_vGenericPos.Set(0, 0, 0);

	InitGeometry();
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
DEFINE_THREAD_ROUTINE(directx_renderer_thread, data)
{
    HWND hWnd = NULL;
	
	WNDCLASSEX wc =
	{
		sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
		GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
		L"A.R.Drone Video", NULL
	};
	RegisterClassEx( &wc );

	if (data == NULL)
	{
		// Create the application's window
		hWnd = CreateWindow( L"A.R.Drone Video", L"A.R.Drone Video",
								  WS_OVERLAPPEDWINDOW, 100, 100, 640, 480,
								  NULL, NULL, wc.hInstance, NULL );
	}
	else
	{
		hWnd = (HWND)data;
	}

    // Initialize Direct3D
    if( SUCCEEDED( InitD3D( hWnd ) ) )
    {
        // Create the scene geometry
        if( SUCCEEDED( InitGeometry() ) )
        {
            // Show the window
            ShowWindow( hWnd, SW_SHOWDEFAULT );
            UpdateWindow( hWnd );

            // Enter the message loop
            MSG msg;
            ZeroMemory( &msg, sizeof( msg ) );
            while( msg.message != WM_QUIT )
            {
                if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
                {
                    TranslateMessage( &msg );
                    DispatchMessage( &msg );
                }
                else
                    Render();
            }
        }
    }
	
	UnregisterClass( L"A.R.Drone Video", wc.hInstance );

	/* Tells ARDRoneTool to shutdown */
	signal_exit();

    return 0;
}
//-----------------------------------------------------------------------------
// Name: wWinMain()
// Desc: The application's entry point
//-----------------------------------------------------------------------------
INT WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, INT)
{
	UNREFERENCED_PARAMETER(hInst);

	// Register the window class
	WNDCLASSEX wc =
	{
		sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
		GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
		"Shader Tutorial", NULL
	};
	RegisterClassEx(&wc);

	// Create the application's window
	HWND hWnd = CreateWindow("Shader Tutorial", "Shader Tutorial 00",
		WS_OVERLAPPEDWINDOW, 100, 100, 500, 500,
		NULL, NULL, wc.hInstance, NULL);

	// Direct3Dを初期化。
	InitD3D(hWnd);
	//モデルを初期化。
	InitGeometry();
	//エフェクトファイルのロード。
	LoadEffectFile();
	
	ZeroMemory( g_diffuseLightDirection, sizeof(g_diffuseLightDirection) );
	ZeroMemory( g_diffuseLightColor, sizeof(g_diffuseLightColor) );
			
	D3DXMatrixIdentity(&g_worldMatrix);
	D3DXMatrixIdentity(&g_rotationMatrix);
	//カメラの初期化。
	camera.Init();
	// Show the window
	ShowWindow(hWnd, SW_SHOWDEFAULT);
	UpdateWindow(hWnd);

	// ゲームループ
	MSG msg;
	ZeroMemory(&msg, sizeof(msg));
	while (msg.message != WM_QUIT)
	{
		if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else {
			Update();
			Render();
		}
	}
	

	UnregisterClass("Shader Tutorial", wc.hInstance);
	return 0;
}
Beispiel #8
0
//draw triangle by given points A,B,and C
void draw_triangle(float A1,float A2,float A3,float B1,float B2,float B3,float C1,float C2, float C3){
  glPushMatrix();
  verts[0].LL[0] = A1; verts[0].LL[1] = A2; verts[0].LL[2] = A3; verts[0].LL[3] = 1;
  verts[1].LL[0] = B1; verts[1].LL[1] = B2; verts[1].LL[2] = B3; verts[1].LL[3] = 1;
  verts[2].LL[0] = C1; verts[2].LL[1] = C2; verts[2].LL[2] = C3; verts[2].LL[3] = 1;
  glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)*6, verts, GL_STATIC_DRAW);
  glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, (char*) NULL+0);
  InitGeometry();
  glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex)*6, verts, GL_STATIC_DRAW);
  glPopMatrix();
}
//--------------------------------------------------------------------------------------------
void MEkranoplan::Init()
{
    initializeOpenGLFunctions();///////

//! [0]
    glGenBuffers(2, vboIds);

//! [0]

    // Initializes cube geometry and transfers it to VBOs
    InitGeometry();//////
}
/**-----------------------------------------------------------------------------
 * 프로그램 시작점
 *------------------------------------------------------------------------------
 */
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
{
    /// 윈도우 클래스 등록
    WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
                      GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
                      "BasicFrame", NULL };
    RegisterClassEx( &wc );

    /// 윈도우 생성
    HWND hWnd = CreateWindow( "BasicFrame", WINDOW_TITLE,
                              WS_OVERLAPPEDWINDOW, 100, 100, WINDOW_W, WINDOW_H,
                              GetDesktopWindow(), NULL, wc.hInstance, NULL );

	g_hwnd = hWnd;

	srand( GetTickCount() );

    /// Direct3D 초기화
    if( SUCCEEDED( InitD3D( hWnd ) ) )
    {
		if( SUCCEEDED( InitObjects() ) )
		{
			if( SUCCEEDED( InitGeometry() ) )
			{

        		/// 윈도우 출력
				ShowWindow( hWnd, SW_SHOWDEFAULT );
				UpdateWindow( hWnd );

        		/// 메시지 루프
				MSG msg;
				ZeroMemory( &msg, sizeof(msg) );
				while( msg.message!=WM_QUIT )
				{
            		/// 메시지큐에 메시지가 있으면 메시지 처리
					if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
					{
						TranslateMessage( &msg );
						DispatchMessage( &msg );
					}
					else
					/// 처리할 메시지가 없으면 Render()함수 호출
						Render();
				}
			}
		}
    }

	DeleteObjects();
    UnregisterClass( "BasicFrame", wc.hInstance );
    return 0;
}
Beispiel #11
0
/**-----------------------------------------------------------------------------
* 프로그램 시작점
*------------------------------------------------------------------------------
*/
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
{
	/// 윈도우 클래스 등록
	WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
		GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
		"BasicFrame", NULL };
	RegisterClassEx( &wc );

	/// 윈도우 생성
	HWND hWnd = CreateWindow( "BasicFrame", "TextureSplatting",
		WS_OVERLAPPEDWINDOW, 100, 100, WIDTH, HEIGHT,
		GetDesktopWindow(), NULL, wc.hInstance, NULL );

	GetClientRect( hWnd, &g_rtClient );

	/// Direct3D 초기화
	if( SUCCEEDED( InitD3D( hWnd ) ) )
	{
		if( SUCCEEDED( InitGeometry() ) )
		{
			/// 윈도우 출력
			ShowWindow( hWnd, SW_SHOWDEFAULT );
			UpdateWindow( hWnd );

			InitApp();

			/// 메시지 루프
			MSG msg;
			ZeroMemory( &msg, sizeof(msg) );
			while( msg.message!=WM_QUIT )
			{
				/// 메시지큐에 메시지가 있으면 메시지 처리
				if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
				{
					TranslateMessage( &msg );
					DispatchMessage( &msg );
				}
				else
				{
					/// 처리할 메시지가 없으면 Render()함수 호출
					Update();
					Render();
				}
			}
		}
	}

	/// 등록된 클래스 소거
	UnregisterClass( "D3D Tutorial", wc.hInstance );
	return 0;
}
Beispiel #12
0
//called once to set up game
void InitGame(void)
{
   memset(&g_player, 0, sizeof(g_player));
   memset(&g_starfield, 0, sizeof(g_starfield));
   memset(&g_hisct, 0, sizeof(g_hisct));

   ReadHiScoreTable(&g_hisct);

   InitGeometry();
   FillAsteroidModel();
   FillPlayerModel();
   FillAlienModel();

   InitStarfield(&g_starfield);
}
Beispiel #13
0
//-----------------------------------------------------------------------------
// Desc: 入口函数
//-----------------------------------------------------------------------------
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
{
	//注册窗口类
	WNDCLASSEX wc = { 
		sizeof(WNDCLASSEX), CS_CLASSDC , MsgProc, 0L, 0L, 
		GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
		L"ClassName", NULL };
		RegisterClassEx( &wc );

		//创建窗口
		HWND hWnd = CreateWindow( 
			L"ClassName", L"坐标变换",
			WS_OVERLAPPEDWINDOW, 200, 100, 500,500,
			GetDesktopWindow(), NULL, wc.hInstance, NULL );
		g_Wnd=hWnd;

		//初始化Direct3D
		if( SUCCEEDED( InitD3D( hWnd ) ) )
		{
			//创建场景图形
			if( SUCCEEDED( InitGeometry() ) )
			{
				//显示窗口
				ShowWindow( hWnd, SW_SHOWDEFAULT );
				UpdateWindow( hWnd );

				//进入消息循环
				MSG msg;
				ZeroMemory( &msg, sizeof(msg) );
				while( msg.message!=WM_QUIT )
				{
					if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
					{
						TranslateMessage( &msg );
						DispatchMessage( &msg );
					}
					else
					{
						Render();  //渲染图形
					}
				}
			}
		}

		UnregisterClass( L"ClassName", wc.hInstance );
		return 0;
}
Beispiel #14
0
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: The application's entry point
//-----------------------------------------------------------------------------
INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT )
{
    UNREFERENCED_PARAMETER( hInst );

    // Register the window class
    WNDCLASSEX wc =
    {
        sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
        GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
        L"D3D Tutorial", NULL
    };
    RegisterClassEx( &wc );

    // Create the application's window
    HWND hWnd = CreateWindow( L"D3D Tutorial", L"D3D Tutorial 03: Matrices",
                              WS_OVERLAPPEDWINDOW, 100, 100, 256, 256,
                              NULL, NULL, wc.hInstance, NULL );

    // Initialize Direct3D
    if( SUCCEEDED( InitD3D( hWnd ) ) )
    {
        // Create the scene geometry
        if( SUCCEEDED( InitGeometry() ) )
        {
            // Show the window
            ShowWindow( hWnd, SW_SHOWDEFAULT );
            UpdateWindow( hWnd );

            // Enter the message loop
            MSG msg;
            ZeroMemory( &msg, sizeof( msg ) );
            while( msg.message != WM_QUIT )
            {
                if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
                {
                    TranslateMessage( &msg );
                    DispatchMessage( &msg );
                }
                else
                    Render();
            }
        }
    }

    UnregisterClass( L"D3D Tutorial", wc.hInstance );
    return 0;
}
Beispiel #15
0
void CPlyRender::Init(GLFWwindow* _glfw_window){
	InitGeometry();
	InitWall();
	InitCubeMapping();
	
	InitShader();

	glfwSetWindowUserPointer(_glfw_window, this);
	glEnable(GL_MULTISAMPLE);
	glfwSetScrollCallback(_glfw_window, wheel);
	glfwSetWindowSizeCallback(_glfw_window, miffy::reshape);
	glfwSetMouseButtonCallback(_glfw_window, miffy::mousebutton);
	glfwSetCursorPosCallback(_glfw_window, miffy::mousemove);
	glfwSetKeyCallback(_glfw_window, keyCallback);

	glShadeModel(GL_FLAT);
}
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: The application's entry point
//-----------------------------------------------------------------------------
INT D3DSample::CreateSample()
{
	// Register the window class
	WNDCLASSEX wc =
	{
		sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc2, 0L, 0L,
		GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
		L"D3D Tutorial", NULL
	};
	RegisterClassEx( &wc );

	// Create the application's window
	HWND hWnd = CreateWindow( L"D3D Tutorial", L"D3D Tutorial 06: Meshes2",
							  WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
							  NULL, NULL, wc.hInstance, NULL );

	// Initialize Direct3D
	if ( SUCCEEDED( InitD3D( hWnd ) ) )
	{
		// Create the scene geometry
		if ( SUCCEEDED( InitGeometry() ) )
		{
			// Show the window
			ShowWindow( hWnd, SW_SHOWDEFAULT );
			UpdateWindow( hWnd );

			// Enter the message loop
			MSG msg;
			ZeroMemory( &msg, sizeof( msg ) );
			while ( msg.message != WM_QUIT )
			{
				if ( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
				{
					TranslateMessage( &msg );
					DispatchMessage( &msg );
				}
				else
					Render();
			}
		}
	}

	UnregisterClass( L"D3D Tutorial", wc.hInstance );
	return 0;
}
Beispiel #17
0
int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
	glutInitWindowSize(RENDER_WIDTH,RENDER_HEIGHT);

	glutCreateWindow("shader cube");
	glutDisplayFunc(display_everything); // shadow
	//glutDisplayFunc(display);
	//glutDisplayFunc(displayBumpMapping );
	glutMouseFunc(mymouse);
	glutMotionFunc(mymotion);
	glutKeyboardFunc(mykey);

	// initialize GLEW

	GLenum err = glewInit();

	if ( err != GLEW_OK)
		printf(" Error initializing GLEW! \n");
	else
		printf("Initializing GLEW succeeded!\n");

	string fileLoc = "/home/arindam/Course/lab5/src/cubeXform";
	//programObject = SetupGLSL("/home/arindam/Course/lab3/cse5542Lab3/cubeXform");  //create shaders - assume the shaders are cubeXform.vert and cubeXform.frag
	programObject = SetupGLSL("/home/arindam/workspace/cse5542lab5/cubeXform");
	InitGeometry();

	InitTexture();

	generateShadowFBO();
	glEnable(GL_DEPTH_TEST);
	glClearColor(0,0,0,1.0f);

	glEnable(GL_CULL_FACE);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);



	cout <<"init geometry done "<<endl;
	InitVBO();
	cout <<" init vbo "<<endl;
	cout <<" init texture "<<endl;
	glutMainLoop();
}
Beispiel #18
0
int main(int argc, char** argv) {
  InitGeometry();
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
  glutInitWindowSize(500,500);
  glutCreateWindow("Lab3 Kevin Yen");
  glutDisplayFunc(display);
  glutMouseFunc(mymouse); 
  glutMotionFunc(mymotion);
  glutKeyboardFunc(mykey); 
  printf("%s\n","please see readme.txt for control detail");
  #ifdef __APPLE__
  #else
    glewInit(); 
  #endif
  InitVBO(); 
  glutMainLoop();
}
Beispiel #19
0
void CausticsRender::Init(GLFWwindow* _glfw_window){
	InitGeometry();
	mCoordinate.init(1.0);
	miffy::GetGLError("InitGeometry");
	InitCubeMapping();
	mSkyBox.init(mCubeMapTexId[CUBEMAP]);

	mOceanSurface.init();

	glfwSetWindowUserPointer(_glfw_window, this);
	glEnable(GL_MULTISAMPLE);
	glfwSetScrollCallback(_glfw_window, wheel);
	glfwSetWindowSizeCallback(_glfw_window, miffy::reshape);
	glfwSetMouseButtonCallback(_glfw_window, miffy::mousebutton);
	glfwSetCursorPosCallback(_glfw_window, miffy::mousemove);
	glfwSetKeyCallback(_glfw_window, keyCallback);

}
Beispiel #20
0
int main(int argc, char** argv) {
  InitGeometry();
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
  glutInitWindowSize(500,500);
  glutCreateWindow("Lab2");
  glutDisplayFunc(display);
  glutMouseFunc(mymouse); 
  glutMotionFunc(mymotion);
  glutKeyboardFunc(mykey); 
  #ifdef __APPLE__
  #else
    glewInit(); 
  #endif
  InitVBO(); 
  glutMainLoop();

}
Beispiel #21
0
//------------------------------------------------------------------------
bool CVehiclePartAnimated::Init(IVehicle* pVehicle, const CVehicleParams &table, IVehiclePart* parent, CVehicle::SPartInitInfo &initInfo, int partType)
{
	if (!CVehiclePartBase::Init(pVehicle, table, parent, initInfo, eVPT_Animated))
		return false;

	if (CVehicleParams animatedTable = table.findChild("Animated"))
	{
		animatedTable.getAttr("ignoreDestroyedState", m_ignoreDestroyedState);
	}

	InitGeometry();

	m_state = eVGS_Default;

	m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_AlwaysUpdate);

	return true;
}
Beispiel #22
0
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: The application's entry point
//-----------------------------------------------------------------------------
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
{
    // Register the window class
    WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
                      GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
                      "D3D Tutorial", NULL };
    RegisterClassEx( &wc );

    // Create the application's window
    HWND hWnd = CreateWindow( "D3D Tutorial", "D3D Tutorial 05: Textures",
                              WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
                              GetDesktopWindow(), NULL, wc.hInstance, NULL );

    // Initialize Direct3D
    if( SUCCEEDED( InitD3D( hWnd ) ) )
    {
        // Create the scene geometry
        if( SUCCEEDED( InitGeometry() ) )
        {
            // Show the window
            ShowWindow( hWnd, SW_SHOWDEFAULT );
            UpdateWindow( hWnd );

            // Enter the message loop
            MSG msg;
            ZeroMemory( &msg, sizeof(msg) );
            while( msg.message!=WM_QUIT )
            {
                if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
                {
                    TranslateMessage( &msg );
                    DispatchMessage( &msg );
                }
                else
                    Render();
            }
        }
    }

    // Clean up everything and exit the app
    Cleanup();
    UnregisterClass( "D3D Tutorial", wc.hInstance );
    return 0;
}
//main 함수
INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT )
{
	hInst;

	WNDCLASSEX wc =
	{
		sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
		GetModuleHandle( NULL ), NULL, LoadCursor( NULL, IDC_ARROW ), NULL, NULL,
		L"D3D Tutorial", NULL
	};
	RegisterClassEx( &wc );

	HWND hWnd = CreateWindow( L"D3D Tutorial", L"collision Check", WS_OVERLAPPEDWINDOW, 100, 100, 600, 600, NULL, NULL, wc.hInstance, NULL );

	if ( SUCCEEDED( InitD3D( hWnd ) ) )
	{
		if ( SUCCEEDED( InitGeometry( ) ) )
		{
			ShowWindow( hWnd, SW_SHOWDEFAULT );
			UpdateWindow( hWnd );

			MSG msg;
			ZeroMemory( &msg, sizeof( msg ) );

			while ( msg.message != WM_QUIT )
			{
				if ( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
				{
					TranslateMessage( &msg );
					DispatchMessage( &msg );
				}
				else
				{
					Update();
					Render();
				}
			}
		}
	}

	UnregisterClass( L"D3D Tutorial", wc.hInstance );
	return 0;
}
Beispiel #24
0
//--------------------------------------------------------------------------------------
// Точка входа в программу. Инициализация всех объектов и вход в цикл сообщений.
// Свободное время используется для отрисовки сцены.
//--------------------------------------------------------------------------------------
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{
    UNREFERENCED_PARAMETER( hPrevInstance );
    UNREFERENCED_PARAMETER( lpCmdLine );

	// Создание окна приложения
    if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
        return 0;

	// Создание объектов DirectX
    if( FAILED( InitDevice() ) )
    {
        CleanupDevice();
        return 0;
    }

	// Создание шейдеров и буфера вершин
    if( FAILED( InitGeometry() ) )
    {
        CleanupDevice();
        return 0;
    }

    // Главный цикл сообщений
    MSG msg = {0};
    while( WM_QUIT != msg.message )
    {
        if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
        {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }
        else	// Если сообщений нет
        {
            Render();	// Рисуем
        }
    }

    CleanupDevice();

    return ( int )msg.wParam;
}
Beispiel #25
0
INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT )
{
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

	WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
		GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
		L"VG Test", NULL };
	RegisterClassEx( &wc );

	HWND hWnd = CreateWindow( L"VG Test", L"VG Test",
		WS_OVERLAPPEDWINDOW, 100, 100, 256, 256,
		NULL, NULL, wc.hInstance, NULL );

	if(FAILED(InitD3D(hWnd))) return 1;

	SetCamera();

	ShowWindow( hWnd, SW_SHOWDEFAULT );
	UpdateWindow( hWnd );

	if(FAILED(InitGeometry())) return 1;

	MSG msg;
	ZeroMemory( &msg, sizeof(msg) );

	while( msg.message != WM_QUIT )
	{
		if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
		{
			TranslateMessage( &msg );
			DispatchMessage( &msg );
		}
		else
			GameMain();
	}

	UnregisterClass( L"VG Test", wc.hInstance );
	return 0;
}
Beispiel #26
0
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: The application's entry point
//-----------------------------------------------------------------------------
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, INT nCmdShow)
{
    UINT uTimerID=0;

    // Initialize COM
    CoInitialize (NULL);

    // Register the window class
    WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
                      GetModuleHandle(NULL), 
                      LoadIcon(hInst, MAKEINTRESOURCE(IDI_TEXTURES)), 
                      NULL, NULL, NULL,
                      CLASSNAME, NULL };
    RegisterClassEx( &wc );
    hInstance = hInst;

    // Create the application's window
    g_hWnd = CreateWindow( CLASSNAME, TEXT("DirectShow Texture3D9 Sample"),
                           WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
                           GetDesktopWindow(), NULL, wc.hInstance, NULL );

    // Add a menu item to the app's system menu
    AddAboutMenuItem(g_hWnd);

    // Initialize Direct3D
    if( SUCCEEDED( InitD3D( g_hWnd ) ) )
    {
        // Create the scene geometry
        if( SUCCEEDED( InitGeometry() ) )
        {
            //
            // Set a timer to queue render operations
            //
            uTimerID = (UINT) SetTimer(g_hWnd, TIMER_ID, TIMER_RATE, NULL);

            // Show the window
            ShowWindow( g_hWnd, SW_SHOWDEFAULT );
            UpdateWindow( g_hWnd );

            // Enter the message loop
            MSG msg;
            ZeroMemory( &msg, sizeof(msg) );

            // Main message loop
            while( msg.message!=WM_QUIT )
            {
                if(GetMessage( &msg, NULL, 0, 0))
                {
                    TranslateMessage(&msg);
                    DispatchMessage(&msg);
                }
            }
        }
    }

    // Stop the rendering timer
    KillTimer(g_hWnd, TIMER_ID);

    // Clean up everything and exit the app
    Cleanup();
    UnregisterClass( CLASSNAME, wc.hInstance );
    CoUninitialize();

    return 0L;
}
Beispiel #27
0
//--------------------------------------------------------------------------------------
// Точка входа в программу. Инициализация всех объектов и вход в цикл сообщений.
// Свободное время используется для отрисовки сцены.
//--------------------------------------------------------------------------------------
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
  UNREFERENCED_PARAMETER(hPrevInstance);
  UNREFERENCED_PARAMETER(lpCmdLine);
  
  // Инициализация игры
  ConwayGame.Init(GAME_WIDTH, GAME_HEIGHT);
  ConwayGame.SetTestValues();

  // Создание окна приложения
  if(FAILED(InitWindow(hInstance, nCmdShow)))
    return 0;

  // Создание объектов DirectX
  if(FAILED(InitDevice()))
  {
    CleanupDevice();
    return 0;
  }

  // Создание шейдеров и буфера вершин
  if(FAILED(LoadShaders()))
  {
    CleanupDevice();
    return 0;
  }

  if(FAILED(InitGeometry()))
  {
    CleanupDevice();
    return 0;
  }

  // Инициализация матриц
  if(FAILED(InitMatrixes()))
  {
    CleanupDevice();
    return 0;
  }

  // Главный цикл сообщений
  MSG msg = {0};
  while(WM_QUIT != msg.message)
  {
    if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }
    else
    {
      if (!(GetTickCount() % 10))
      {
        if(FAILED(InitGeometry()))
        {
          CleanupDevice();
          return 0;
        }
        ConwayGame.Step();
      }
      Render();
    }
  }

  CleanupDevice();
  return (int)msg.wParam;
}
Beispiel #28
0
void PathOCLRenderThread::InitRender() {
	Scene *scene = renderEngine->renderConfig->scene;

	cl::Context &oclContext = intersectionDevice->GetOpenCLContext();
	cl::Device &oclDevice = intersectionDevice->GetOpenCLDevice();
	const OpenCLDeviceDescription *deviceDesc = intersectionDevice->GetDeviceDesc();

	double tStart, tEnd;

	//--------------------------------------------------------------------------
	// FrameBuffer definition
	//--------------------------------------------------------------------------

	InitFrameBuffer();

	//--------------------------------------------------------------------------
	// Camera definition
	//--------------------------------------------------------------------------

	InitCamera();

	//--------------------------------------------------------------------------
	// Scene geometry
	//--------------------------------------------------------------------------

	InitGeometry();

	//--------------------------------------------------------------------------
	// Translate material definitions
	//--------------------------------------------------------------------------

	InitMaterials();

	//--------------------------------------------------------------------------
	// Translate area lights
	//--------------------------------------------------------------------------

	InitAreaLights();

	//--------------------------------------------------------------------------
	// Check if there is an infinite light source
	//--------------------------------------------------------------------------

	InitInfiniteLight();

	//--------------------------------------------------------------------------
	// Check if there is an sun light source
	//--------------------------------------------------------------------------

	InitSunLight();

	//--------------------------------------------------------------------------
	// Check if there is an sky light source
	//--------------------------------------------------------------------------

	InitSkyLight();

	const unsigned int areaLightCount = renderEngine->compiledScene->areaLights.size();
	if (!skyLightBuff && !sunLightBuff && !infiniteLightBuff && (areaLightCount == 0))
		throw runtime_error("There are no light sources supported by PathOCL in the scene");

	//--------------------------------------------------------------------------
	// Translate mesh texture maps
	//--------------------------------------------------------------------------

	InitTextureMaps();

	//--------------------------------------------------------------------------
	// Allocate Ray/RayHit buffers
	//--------------------------------------------------------------------------

	const unsigned int taskCount = renderEngine->taskCount;

	tStart = WallClockTime();

	LM_LOG_ENGINE("[PathOCLRenderThread::" << threadIndex << "] Ray buffer size: " << (sizeof(Ray) * taskCount / 1024) << "Kbytes");
	raysBuff = new cl::Buffer(oclContext,
			CL_MEM_READ_WRITE,
			sizeof(Ray) * taskCount);
	deviceDesc->AllocMemory(raysBuff->getInfo<CL_MEM_SIZE>());

	LM_LOG_ENGINE("[PathOCLRenderThread::" << threadIndex << "] RayHit buffer size: " << (sizeof(RayHit) * taskCount / 1024) << "Kbytes");
	hitsBuff = new cl::Buffer(oclContext,
			CL_MEM_READ_WRITE,
			sizeof(RayHit) * taskCount);
	deviceDesc->AllocMemory(hitsBuff->getInfo<CL_MEM_SIZE>());

	tEnd = WallClockTime();
	LM_LOG_ENGINE("[PathOCLRenderThread::" << threadIndex << "] OpenCL buffer creation time: " << int((tEnd - tStart) * 1000.0) << "ms");

	//--------------------------------------------------------------------------
	// Allocate GPU task buffers
	//--------------------------------------------------------------------------

	// TODO: clenup all this mess

	const size_t gpuTaksSizePart1 =
		// Seed size
		sizeof(PathOCL::Seed);

	const size_t uDataEyePathVertexSize =
		// IDX_SCREEN_X, IDX_SCREEN_Y
		sizeof(float) * 2 +
		// IDX_DOF_X, IDX_DOF_Y
		((scene->camera->lensRadius > 0.f) ? (sizeof(float) * 2) : 0);
	const size_t uDataPerPathVertexSize =
		// IDX_TEX_ALPHA,
		((texMapAlphaBuff) ? sizeof(float) : 0) +
		// IDX_BSDF_X, IDX_BSDF_Y, IDX_BSDF_Z
		sizeof(float) * 3 +
		// IDX_DIRECTLIGHT_X, IDX_DIRECTLIGHT_Y, IDX_DIRECTLIGHT_Z
		(((areaLightCount > 0) || sunLightBuff) ? (sizeof(float) * 3) : 0) +
		// IDX_RR
		sizeof(float);
	const size_t uDataSize = (renderEngine->sampler->type == PathOCL::INLINED_RANDOM) ?
		// Only IDX_SCREEN_X, IDX_SCREEN_Y
		(sizeof(float) * 2) :
		((renderEngine->sampler->type == PathOCL::METROPOLIS) ?
			(sizeof(float) * 2 + sizeof(unsigned int) * 5 + sizeof(Spectrum) + 2 * (uDataEyePathVertexSize + uDataPerPathVertexSize * renderEngine->maxPathDepth)) :
			(uDataEyePathVertexSize + uDataPerPathVertexSize * renderEngine->maxPathDepth));

	size_t sampleSize =
		// uint pixelIndex;
		((renderEngine->sampler->type == PathOCL::METROPOLIS) ? 0 : sizeof(unsigned int)) +
		uDataSize +
		// Spectrum radiance;
		sizeof(Spectrum);

	stratifiedDataSize = 0;
	if (renderEngine->sampler->type == PathOCL::STRATIFIED) {
		PathOCL::StratifiedSampler *s = (PathOCL::StratifiedSampler *)renderEngine->sampler;
		stratifiedDataSize =
				// stratifiedScreen2D
				sizeof(float) * s->xSamples * s->ySamples * 2 +
				// stratifiedDof2D
				((scene->camera->lensRadius > 0.f) ? (sizeof(float) * s->xSamples * s->ySamples * 2) : 0) +
				// stratifiedAlpha1D
				((texMapAlphaBuff) ? (sizeof(float) * s->xSamples) : 0) +
				// stratifiedBSDF2D
				sizeof(float) * s->xSamples * s->ySamples * 2 +
				// stratifiedBSDF1D
				sizeof(float) * s->xSamples +
				// stratifiedLight2D
				// stratifiedLight1D
				(((areaLightCount > 0) || sunLightBuff) ? (sizeof(float) * s->xSamples * s->ySamples * 2 + sizeof(float) * s->xSamples) : 0);

		sampleSize += stratifiedDataSize;
	}

	const size_t gpuTaksSizePart2 = sampleSize;

	const size_t gpuTaksSizePart3 =
		// PathState size
		((((areaLightCount > 0) || sunLightBuff) ? sizeof(PathOCL::PathStateDL) : sizeof(PathOCL::PathState)) +
			//unsigned int diffuseVertexCount;
			((renderEngine->maxDiffusePathVertexCount < renderEngine->maxPathDepth) ? sizeof(unsigned int) : 0));

	const size_t gpuTaksSize = gpuTaksSizePart1 + gpuTaksSizePart2 + gpuTaksSizePart3;
	LM_LOG_ENGINE("[PathOCLRenderThread::" << threadIndex << "] Size of a GPUTask: " << gpuTaksSize <<
			"bytes (" << gpuTaksSizePart1 << " + " << gpuTaksSizePart2 << " + " << gpuTaksSizePart3 << ")");
	LM_LOG_ENGINE("[PathOCLRenderThread::" << threadIndex << "] Tasks buffer size: " << (gpuTaksSize * taskCount / 1024) << "Kbytes");

	// Check if the task buffer is too big
	if (oclDevice.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>() < gpuTaksSize * taskCount) {
		stringstream ss;
		ss << "The GPUTask buffer is too big for this device (i.e. CL_DEVICE_MAX_MEM_ALLOC_SIZE=" <<
				oclDevice.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>() <<
				"): try to reduce opencl.task.count and/or path.maxdepth and/or to change Sampler";
		throw std::runtime_error(ss.str());
	}

	tasksBuff = new cl::Buffer(oclContext,
			CL_MEM_READ_WRITE,
			gpuTaksSize * taskCount);
	deviceDesc->AllocMemory(tasksBuff->getInfo<CL_MEM_SIZE>());

	//--------------------------------------------------------------------------
	// Allocate GPU task statistic buffers
	//--------------------------------------------------------------------------

	LM_LOG_ENGINE("[PathOCLRenderThread::" << threadIndex << "] Task Stats buffer size: " << (sizeof(PathOCL::GPUTaskStats) * taskCount / 1024) << "Kbytes");
	taskStatsBuff = new cl::Buffer(oclContext,
			CL_MEM_READ_WRITE,
			sizeof(PathOCL::GPUTaskStats) * taskCount);
	deviceDesc->AllocMemory(taskStatsBuff->getInfo<CL_MEM_SIZE>());

	//--------------------------------------------------------------------------
	// Compile kernels
	//--------------------------------------------------------------------------

	InitKernels();

	//--------------------------------------------------------------------------
	// Initialize
	//--------------------------------------------------------------------------

	// Set kernel arguments
	SetKernelArgs();

	cl::CommandQueue &oclQueue = intersectionDevice->GetOpenCLQueue();

	// Clear the frame buffer
	oclQueue.enqueueNDRangeKernel(*initFBKernel, cl::NullRange,
			cl::NDRange(RoundUp<unsigned int>(frameBufferPixelCount, initFBWorkGroupSize)),
			cl::NDRange(initFBWorkGroupSize));

	// Initialize the tasks buffer
	oclQueue.enqueueNDRangeKernel(*initKernel, cl::NullRange,
			cl::NDRange(taskCount), cl::NDRange(initWorkGroupSize));
	oclQueue.finish();

	// Reset statistics in order to be more accurate
	intersectionDevice->ResetPerformaceStats();
}
Beispiel #29
0
void PathOCLRenderThread::EndEdit(const EditActionList &editActions) {
	//--------------------------------------------------------------------------
	// Update OpenCL buffers
	//--------------------------------------------------------------------------

	if (editActions.Has(FILM_EDIT)) {
		// Resize the Framebuffer
		InitFrameBuffer();
	}

	if (editActions.Has(CAMERA_EDIT)) {
		// Update Camera
		InitCamera();
	}

	if (editActions.Has(GEOMETRY_EDIT)) {
		// Update Scene Geometry
		InitGeometry();
	}

	if (editActions.Has(MATERIALS_EDIT) || editActions.Has(MATERIAL_TYPES_EDIT)) {
		// Update Scene Materials
		InitMaterials();
	}

	if  (editActions.Has(AREALIGHTS_EDIT)) {
		// Update Scene Area Lights
		InitAreaLights();
	}

	if  (editActions.Has(INFINITELIGHT_EDIT)) {
		// Update Scene Infinite Light
		InitInfiniteLight();
	}

	if  (editActions.Has(SUNLIGHT_EDIT)) {
		// Update Scene Sun Light
		InitSunLight();
	}

	if  (editActions.Has(SKYLIGHT_EDIT)) {
		// Update Scene Sun Light
		InitSkyLight();
	}

	//--------------------------------------------------------------------------
	// Recompile Kernels if required
	//--------------------------------------------------------------------------

	if (editActions.Has(FILM_EDIT) || editActions.Has(MATERIAL_TYPES_EDIT))
		InitKernels();

	if (editActions.Size() > 0)
		SetKernelArgs();

	//--------------------------------------------------------------------------
	// Execute initialization kernels
	//--------------------------------------------------------------------------

	if (editActions.Size() > 0) {
		cl::CommandQueue &oclQueue = intersectionDevice->GetOpenCLQueue();

		// Clear the frame buffer
		oclQueue.enqueueNDRangeKernel(*initFBKernel, cl::NullRange,
			cl::NDRange(RoundUp<unsigned int>(frameBufferPixelCount, initFBWorkGroupSize)),
			cl::NDRange(initFBWorkGroupSize));

		// Initialize the tasks buffer
		oclQueue.enqueueNDRangeKernel(*initKernel, cl::NullRange,
				cl::NDRange(renderEngine->taskCount), cl::NDRange(initWorkGroupSize));
	}

	// Reset statistics in order to be more accurate
	intersectionDevice->ResetPerformaceStats();

	StartRenderThread();
}
// エントリポイント
int WINAPI _tWinMain( HINSTANCE hInst, HINSTANCE, LPTSTR, int )
{
	LARGE_INTEGER			nNowTime, nLastTime;		// 現在とひとつ前の時刻
	LARGE_INTEGER			nTimeFreq;					// 時間単位

    // 画面サイズ
    g_nClientWidth  = VIEW_WIDTH;						// 幅
    g_nClientHeight = VIEW_HEIGHT;						// 高さ

	// Register the window class
    WNDCLASSEX wc = { sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
                      GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
                      _T( "D3D Sample" ), NULL };
    RegisterClassEx( &wc );

	RECT rcRect;
	SetRect( &rcRect, 0, 0, g_nClientWidth, g_nClientHeight );
	AdjustWindowRect( &rcRect, WS_OVERLAPPEDWINDOW, FALSE );
    g_hWnd = CreateWindow( _T( "D3D Sample" ), _T( "Movement_2_1a" ),
						   WS_OVERLAPPEDWINDOW, 100, 20, rcRect.right - rcRect.left, rcRect.bottom - rcRect.top,
						   GetDesktopWindow(), NULL, wc.hInstance, NULL );

    // Initialize Direct3D
    if( SUCCEEDED( InitD3D() ) && SUCCEEDED( MakeShaders() ) )
    {
        // Create the shaders
        if( SUCCEEDED( InitDrawModes() ) )
        {
			if ( SUCCEEDED( InitGeometry() ) ) {					// ジオメトリ作成

				// Show the window
				ShowWindow( g_hWnd, SW_SHOWDEFAULT );
				UpdateWindow( g_hWnd );

				InitCharacter();									// キャラクタ初期化
				
				QueryPerformanceFrequency( &nTimeFreq );			// 時間単位
				QueryPerformanceCounter( &nLastTime );				// 1フレーム前時刻初期化

				// Enter the message loop
				MSG msg;
				ZeroMemory( &msg, sizeof( msg ) );
				while( msg.message != WM_QUIT )
				{
					Render();
					MoveCharacter();
					do {
						if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
						{
							TranslateMessage( &msg );
							DispatchMessage( &msg );
						}
						QueryPerformanceCounter( &nNowTime );
					} while( ( ( nNowTime.QuadPart - nLastTime.QuadPart ) < ( nTimeFreq.QuadPart / 90 ) ) &&
							 ( msg.message != WM_QUIT ) );
					while( ( ( nNowTime.QuadPart - nLastTime.QuadPart ) < ( nTimeFreq.QuadPart / 60 ) ) &&
						   ( msg.message != WM_QUIT ) )
					{
						QueryPerformanceCounter( &nNowTime );
					}
					nLastTime = nNowTime;
					g_pSwapChain->Present( 0, 0 );					// 表示
				}
			}
        }
    }

    // Clean up everything and exit the app
    Cleanup();
    UnregisterClass( _T( "D3D Sample" ), wc.hInstance );
    return 0;
}