/* getDirectXDisplayModes - This method queries the GPU and gets a vector of all the display modes available, returning this data structure. */ vector<D3DDISPLAYMODE*>* DirectXGraphics::getDirectXDisplayModes() { // WE'LL FILL THIS WITH THE DISPLAY MODES WE FIND vector<D3DDISPLAYMODE*> *displayOptions = new vector<D3DDISPLAYMODE*>(); // WE'LL LOOK AT EACH COLOR MODEL, STARTING WITH ONE AT INDEX 1, IF THERE IS ONE int adapterCounter = 1; D3DFORMAT format; while (adapterCounter < 1000) { format = D3DFORMAT(adapterCounter); // HOW MANY MODES HAVE THIS COLOR MODEL? int numAdapters = d3d->GetAdapterModeCount( D3DADAPTER_DEFAULT, format); // GET ALL FOR THIS COLOR MODEL D3DDISPLAYMODE *displayModes = new D3DDISPLAYMODE[numAdapters]; for (int i = 0; i < numAdapters; i++) { d3d->EnumAdapterModes( D3DADAPTER_DEFAULT, format, i, &displayModes[i]); // PUT THEM INTO OUR VECTOR displayOptions->push_back(&displayModes[i]); } adapterCounter++; } return displayOptions; }
bool DisplayRenderTargetChain::Create(const boost::any& _rConfig) { CreateInfo* pInfo = boost::any_cast<CreateInfo*>(_rConfig); bool bResult = (NULL != pInfo); if (false != bResult) { GraphicConfigDataPtr pGraphicConfig = pInfo->m_pGraphicConfig; for (UInt i = 0 ; pGraphicConfig->m_uDXGBufferCount > i ; ++i) { const string strRTName = boost::str(boost::format("%1%_buffer%2%") % pInfo->m_strName % i); DisplayRenderTarget::CreateInfo oRTRTCInfo = { strRTName, pInfo->m_uWidth, pInfo->m_uHeight, D3DFORMAT(pGraphicConfig->m_aDXGBufferFormat[i]), i }; DisplayRenderTargetPtr pRT = new DisplayRenderTarget(m_rDisplay); bResult = pRT->Create(boost::any(&oRTRTCInfo)); if (false == bResult) { CoreObject::ReleaseDeleteReset(pRT); break; } m_vGBuffer.push_back(pRT); } m_sDepthBufferIndex = pGraphicConfig->m_sDXGufferDepthIndex; } return bResult; }