+ hr = CreateDXGIFactory(IID_IDXGIFactory, (void**)(&g_pFactory) );
+ if (FAILED(hr)) {
+ return 1;
+ }
+
+ hr = g_pFactory->EnumAdapters(0, &g_pAdapter);
+ if (FAILED(hr)) {
+ return 1;
+ }
+
+ hr = D3D10CreateDevice(g_pAdapter,
+ D3D10_DRIVER_TYPE_HARDWARE,
+ NULL,
+ Flags,
+ D3D10_SDK_VERSION,
+ &g_pDevice);
+ if (FAILED(hr)) {
+ return 1;
+ }
+