ÀÌÀå¿¡¼­´Â ´ÙÀ̾ó·Î±× ¹Ú½º·Î À©µµ¿ì ¸ðµå³ª Ç® ¸ðµå¸¦ ¼±ÅÃÇÑÈÄ Çػ󵵸¦ ¼±ÅÃÇÒ¼ö ÀÖµµ·Ï ÇÏÀÚ.

¼±ÅÃÇÒÇÒ¼ö ÀÖ´Â Á¶°ÇÀº ¾Æ·¡¿Í °°´Ù.
      -window or full screen
      -À©µµÀÇ Å©±â 
      -ÇØ»óµµ    
      -Ä®¶óÀÇÀÇ ¼ö 
      -Ç®½ºÅ©¸°¿¡¼­ ¸®ÇÁ·¹½Ã ºñÀ²

¿øÇÏ´Â ¸ðµå¸¦ ¼±ÅÃÇϱâ À§Çؼ­ ´ÙÀ̾ó·Î±× ¹Ú½º¸¦ ¶ç¿ì´Â Äڵ带 AppInit()ÇÔ¼ö¿¡ Ãß°¡ÇÑ´Ù.
	if(!DialogBox (hInst, MAKEINTRESOURCE(IDD_STARTUP), 0 , (DLGPROC) SelectVideoModeDlg)) 
		return false;
 
g_bIsFullScreen º¯¼ö°¡ trueÀ̸é Ǯȭ¸éÀ¸·Î falseÀ̸é À©µµ¿ì ¸ðµå·Î ¼ÂÆÃÇÑ´Ù.

bool g_bIsFullScreen = false;	    // is our app Full screen or not
int g_iScreenX = 0, g_iScreenY = 0;	// use this if 'not'
D3DDISPLAYMODE *g_pd3ddm;	        // use this if 'yes'
int g_iModeNum = 0;			        // using this D3DDISPLAYMODE

Äڵ带 ÀÌÇØ Çϴµ¥ º°´Ù¸¥ ¾î·Á¿òÀº ¾øÀ»°ÍÀÌ´Ù.
´ÙÀÌ·ºÆ® XÀÇ Ç® ¸ðµå¸¦ ¾ò¾î¿À´Â ºÎºÐ¸¸ ¼³¸íÇÒ°ÍÀÌ´Ù.

LPDIRECT3D8    p_d3dt =  Direct3DCreate8 (D3D_SDK_VERSION);
D3DDISPLAYMODE d3ddm2;
int allVideoModes = p_d3dt->GetAdapterModeCount(D3DADAPTER_DEFAULT);

			//¾Æ·¡ ÄÚµå´Â SelectVideoModeDlg()¿¡ ÀÖ´Ù.
			LPDIRECT3D8 p_d3d = Direct3DCreate8 (D3D_SDK_VERSION);
			int allVideoModes = p_d3d->GetAdapterModeCount (D3DADAPTER_DEFAULT);
			g_pd3ddm = new D3DDISPLAYMODE[allVideoModes];
			for (int i=0; i < allVideoModes; i++)
			{
				p_d3d->EnumAdapterModes (D3DADAPTER_DEFAULT, i, &g_pd3ddm[i]);
				char str[30];
				int bpp=0;
				if(g_pd3ddm[i].Format == D3DFMT_X1R5G5B5) bpp=16;
				if(g_pd3ddm[i].Format == D3DFMT_R5G6B5) bpp=16;
				if(g_pd3ddm[i].Format == D3DFMT_A1R5G5B5) bpp=16;
				if(g_pd3ddm[i].Format == D3DFMT_A4R4G4B4) bpp=16;
				if(g_pd3ddm[i].Format == D3DFMT_X4R4G4B4) bpp=16;
				if(g_pd3ddm[i].Format == D3DFMT_R8G8B8) bpp=24;
				if(g_pd3ddm[i].Format == D3DFMT_X8R8G8B8) bpp=32;
				if(g_pd3ddm[i].Format == D3DFMT_A8R8G8B8) bpp=32;
				sprintf(str, "%dx%dx%d _ %dhz", g_pd3ddm[i].Width, 
									g_pd3ddm[i].Height, bpp, g_pd3ddm[i].RefreshRate);
				ComboBox_AddString (hFSMlist, str);
			};

			_RELEASE_ (p_d3d);

ºñµð¿À ¸ðµå¸¦ ¾Ë¾Æ³»±â À§ÇØ ÀÓ½ÃÀûÀ¸·Î D3D ÀÎÅÍÆäÀ̽º¸¦ ¸¸µç´Ù(Direct3DCreate8 (D3D_SDK_VERSION)).
p_d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT)¸¦ »ç¿ëÇÏ¿© ºñµð¿À ¸ðµåÀÇ »ç¿ë °¡´ÉÇÑ °¹¼ö¸¦ ±¸ÇÑ´Ù.
p_d3d->EnumAdapterModes (D3DADAPTER_DEFAULT, i, &g_pd3ddm[i])¸¦ ÅëÇÏ¿© Ä®¶ó¼ö¸¦ ±¸ÇÑ´Ù.
±×¸®°í ³ª¸ÓÁö À©µµ¿ìÀÇ ³ôÀÌ¿Í Æø ¸®ÇÁ·¹½Ã ºñÀ²À» ±¸ÇÒ¼ö ÀÖ´Ù.

HRESULT InitD3D(HWND hWnd)
{
	ZeroMemory (&g_d3dpp, sizeof(g_d3dpp));

    if( NULL == ( g_d3d = Direct3DCreate8( D3D_SDK_VERSION ) ) )
        return E_FAIL;

	if(g_bIsFullScreen)
	{
		g_d3dpp.BackBufferWidth = g_pd3ddm[g_iModeNum].Width;
		g_d3dpp.BackBufferHeight = g_pd3ddm[g_iModeNum].Height;
		g_d3dpp.BackBufferCount = 1;
		g_d3dpp.FullScreen_RefreshRateInHz = g_pd3ddm[g_iModeNum].RefreshRate; //D3DPRESENT_RATE_DEFAULT
		g_d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
	}
	else
	{
		if( FAILED( g_d3d->GetAdapterDisplayMode (D3DADAPTER_DEFAULT, &g_pd3ddm[g_iModeNum])))
			return E_FAIL;
	}

    g_d3dpp.Windowed = !g_bIsFullScreen;
    g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    g_d3dpp.BackBufferFormat = g_pd3ddm[g_iModeNum].Format;

    if(FAILED(g_d3d->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, 
								   D3DCREATE_SOFTWARE_VERTEXPROCESSING, 
								   &g_d3dpp, &g_d3d_Device)))
	{
		return E_FAIL;
	}

	return S_OK;
}

À§ÀÇ ÄÚµå´Â ½ÇÁ¦ÀûÀ¸·Î È­¸éÀ» ¼ÂÆÃÇϴ°ÍÀÌ´Ù.
-ù° µð¹ÙÀ̽ºÀÇ width¿Í Height¸¦ ´ëÀÔÇÑ´Ù.
-¹é¹öÆÛÀÇ °¹¼ö¸¦ ³Ö´Â´Ù.
-½ºÅ©¸°ÀÇ ¸®ÇÁ·¹½Ã ºñÀ²À» ´ëÀÔÇÑ´Ù.

-À©µµ¿ì ¸ðµå·Î »ç¿ëÇÒ°ÍÀÎÁö üũÇÑ´Ù (g_d3dpp.Windowed = !g_bIsFullScreen)
-Æ÷¸ËÀ» ¼ÂÆÃÇÑ´Ù.
-½ºÅ©¸°ÀÇ ¾÷±×·¹À̵带 ¹æ¹ýÀ» ¼ÂÆÃÇÑ´Ù.

void DestroyDirect3D8()
{
	_RELEASE_ (g_VertexBuffer);
	_RELEASE_ (g_d3d_Device);
	_RELEASE_ (g_d3d);
	if(g_pd3ddm)
	{
		delete [] g_pd3ddm;
		g_pd3ddm = NULL;
	}
}

¸¶Áö¸·À¸·Î ÇÒ´çµÈ µð½ºÇ÷¹ÀÌ ¸ðµåµéÀ» ÇØÁ¦ ½ÃŲ´Ù.