Graphics Reference
In-Depth Information
for(UINT t = 0; t < dwNumTechniques; t++)
{
StringCchPrintfA(strBuffer, MAX_PATH - 1, “%s”, g_Techniques[t]);
*pHandle++ = g_pEffect->GetTechniqueByName(strBuffer);
}
return S_OK;
}
//—————————————————————————————————————————————————————————————————————————
//Create any D3D9 resources that will live through a device reset
//(D3DPOOL_MANAGED) and aren't tied to the back buffer size
//—————————————————————————————————————————————————————————————————————————
HRESULT CALLBACK OnCreateDevice(IDirect3DDevice9* pd3dDevice, const
D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext)
{
HRESULT hr;
V_RETURN(g_DialogResourceManager.OnD3D9CreateDevice(pd3dDevice));
V_RETURN(g_SettingsDlg.OnD3D9CreateDevice(pd3dDevice));
g_pd3dDevice = pd3dDevice;
D3DCAPS9 d3dCaps;
pd3dDevice->GetDeviceCaps(&d3dCaps);
if(!(d3dCaps.DevCaps & D3DDEVCAPS_NPATCHES))
{
//No hardware support. Disable the checkbox.
g_bUseHWNPatches = false;
g_SampleUI.GetCheckBox(IDC_HWNPATCHES)->SetChecked(false);
g_SampleUI.GetCheckBox(IDC_HWNPATCHES)->SetEnabled(false);
}
else
g_SampleUI.GetCheckBox(IDC_HWNPATCHES)->SetEnabled(true);
//Initialize the font
V_RETURN(D3DXCreateFont(pd3dDevice, 15, 0, FW_BOLD, 1, FALSE,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH |
FF_DONTCARE, L”Arial”, &g_pFont));
g_DwShaderFlags = D3DXFX_NOT_CLONEABLE;
#if defined(DEBUG) || defined(_DEBUG)
g_DwShaderFlags | = D3DXSHADER_DEBUG;
#endif
#ifdef DEBUG_VS
g_DwShaderFlags | = D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT;
#endif
#ifdef DEBUG_PS
g_DwShaderFlags | = D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT;
#endif
V_RETURN(LoadMesh(pd3dDevice, g_CurrentModel));
V_RETURN(LoadEffect(pd3dDevice, L”EnhancedMesh.fx”));
RetrieveTechHandles();
Search WWH ::




Custom Search