Á¦ 4Àå¿¡¼­ Ç®½ºÅ©¸° ¸ðµå·Î ½ÇÇàÇÏ´Â Áß¿¡ ALT + TABÀ» ´©¸£°Ô µÇ¸é D3D8 µð¹ÙÀ̽º¸¦ ¼Ò½ÇÇÏ¿© Á¾·áÇÏ°Ô µÉ°ÍÀÌ´Ù.
À̹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ RenderRoop()ÇÔ¼ö¿Í CreateVertexBuffer¿¡¼­ 2°¡Áö ÀÛ¾÷À» Ãß°¡ÇÑ´Ù.

1)
HRESULT ResetDeviceObjects()
{
	HRESULT hr;

    // Release all vidmem objects
    //if( FAILED( hr = InvalidateDeviceObjects() ) )
    //    return hr;

	// Reset the device
	if( FAILED( hr = g_d3d_Device->Reset( &g_d3dpp ) ) )
		return hr;

	return S_OK;
}


HRESULT RenderLoop()
{
    HRESULT hr;

    // Test the cooperative level to see if it's okay to render
    if( FAILED( hr = g_d3d_Device->TestCooperativeLevel() ) )
    {
        // If the device was lost, do not render until we get it back
        if( D3DERR_DEVICELOST == hr )
            return S_OK;

        // Check if the device needs to be resized.
        if( D3DERR_DEVICENOTRESET == hr )
        {
            // If we are windowed, read the desktop mode and use the same format for
            // the back buffer
            if( !g_bIsFullScreen )
            {
				g_d3d->GetAdapterDisplayMode (D3DADAPTER_DEFAULT, &g_pd3ddm[g_iModeNum]);
                g_d3dpp.BackBufferFormat = g_pd3ddm[g_iModeNum].Format;
            }

            if( FAILED( hr = ResetDeviceObjects() ) )
                return hr;
        }
        return hr;
    }

    // Render the scene as normal
    if( FAILED( hr = Render3D() ) )
        return hr;

	return S_OK;
}

TestCooperativeLevel() ´ÙÀÌ·ºÆ® X API·Î µð¹ÙÀ̽º ºÐ½Ç, µð¹ÙÀ̽º ¿À·ù¸¦ üũÇÑ´Ù.
- µð¹ÙÀ̽º¸¦ ºÐ½Ç(D3DERR_DEVICELOST)ÇßÀ»¶§´Â ¸Þ¼¼Áö ·çÇÁ¸¦ °è¼Ó µ¹°ÔµÈ´Ù.
- D3DERR_DEVICENOTRESETÀ̸é ResetDeviceObjects()¿¡ ÀÇÇØ µð¹ÙÀ̽º¸¦ ¸®¼ÂÇÑ´Ù.
- µð¹ÙÀ̽º ¸®¼ÂÀ» ½ÇÆÐÇϸé Á¾·áÇÑ´Ù. 

CreateVertexBuffer¿¡¼­ D3DPOOL_DEFAULT Ç÷¡±×¸¦ »ç¿ëÇÑ´Ù. µðÆúÆ® µð¹ÙÀ̽º ¸®¼Ò½º Ç÷¡±×ÀÌ´Ù.
D3DPOOL_DEFAULTÇ÷¡±×¸¦ D3DPOOL_MANAGEDÇ÷¡±×·Î ¼öÁ¤ÇÑ´Ù.
D3DPOOL_MANAGEDÇ÷¡±×´Â D3D8 µð¹ÙÀ̽º ÀÚü¿¡¼­ ¸®¼Ò½º¸¦ °ü¸®ÇØ ¸®¼Ò½º¸¦ ÀÒ¾î¹ö¸®Áö ¾Êµµ·Ï ÇÑ´Ù.
  
2)
      g_d3d_Device->CreateVertexBuffer (6*sizeof(CUSTOMVERTEX), 
										0, 
										D3DFVF_CUSTOMVERTEX, 
										D3DPOOL_MANAGED, 
										&g_VertexBuffer);

ÀÌÁ¦ µð¹ÙÀ̽º¸¦ ÀÒ¾î¹ö¸®´Â ÀÏÀÌ ÀϾÁö ¾ÊÀ» °ÍÀÌ´Ù.