Graphics Reference
In-Depth Information
for(int i = 1; i < 16; i + = 2)
{
g_SampleUI.GetComboBox(IDC_CUBETEXTURE)->
AddItem(g_CubeTextures[i], (void*)i);
}
g_SampleUI.AddStatic(IDC_MODELREFLECTIVITYLABEL, L”Model
Reflectivity : 30”, 10, iY + = 35, 150, 16);
g_SampleUI.AddSlider(IDC_MODELREFLECTIVITY, 10, iY + = 14, 150,
24, 0, 100, 30);
g_SampleUI.AddStatic(IDC_ACTIVEEFFECTLABEL, L”Active Shader”, 10,
iY + = 26, 150, 16);
g_SampleUI.AddComboBox(IDC_ACTIVEEFFECT, -10, iY + = 14, 170, 24);
for(int i = 0; i < 6; ++i)
{
g_SampleUI.GetComboBox(IDC_ACTIVEEFFECT)->
AddItem(g_TechniqueNames[i], (void*)i);
}
}
//—————————————————————————————————————————————————————————————————————————
//Rejects any D3D9 devices that aren't acceptable to the app by
//returning false
//—————————————————————————————————————————————————————————————————————————
bool CALLBACK IsDeviceAcceptable(D3DCAPS9* pCaps, D3DFORMAT
AdapterFormat, D3DFORMAT BackBufferFormat, bool bWindowed, void*
pUserContext)
{
//Skip backbuffer formats that don't support alpha blending
IDirect3D9* pD3D = DXUTGetD3D9Object();
if(FAILED(pD3D->CheckDeviceFormat(pCaps->AdapterOrdinal,
pCaps->DeviceType, AdapterFormat, D3DUSAGE_QUERY_POSTPIXELSHADER_
BLENDING, D3DRTYPE_TEXTURE, BackBufferFormat)))
return false;
//Must support pixel shader 2.0
if(pCaps->PixelShaderVersion < D3DPS_VERSION(2, 0))
return false;
return true;
}
//—————————————————————————————————————————————————————————————————————————
//Before a device is created, modify the device settings as needed
//—————————————————————————————————————————————————————————————————————————
bool CALLBACK ModifyDeviceSettings(DXUTDeviceSettings*
pDeviceSettings, void* pUserContext)
{
assert(DXUT_D3D9_DEVICE = = pDeviceSettings->ver);
HRESULT hr;
IDirect3D9* pD3D = DXUTGetD3D9Object();
D3DCAPS9 caps;
V(pD3D->GetDeviceCaps(pDeviceSettings->d3d9.AdapterOrdinal,
pDeviceSettings->d3d9.DeviceType, &caps));
Search WWH ::




Custom Search