
i
i
i
i
i
i
i
i
420 15. Using Multimedia in VR
HRESULT CRendererD3D::SetMediaType(const CMediaType
*
pmt){
HRESULT hr; UINT uintWidth = 2,uintHeight = 2;
// Retrive the size of this media type
D3DCAPS9 caps;
VIDEOINFO
*
pviBmp; // Bitmap info header
pviBmp = (VIDEOINFO
*
)pmt->Format();
m_lVidWidth = pviBmp->bmiHeader.biWidth;
m_lVidHeight = abs(pviBmp->bmiHeader.biHeight);
m_lVidPitch = (m_lVidWidth
*
3 + 3) & ˜(3); // We are forcing RGB24
ZeroMemory( &caps, sizeof(D3DCAPS9));
hr = g_pd3dDevice->GetDeviceCaps( &caps );
if( caps.TextureCaps & D3DPTEXTURECAPS_POW2 ){
while( (LONG)uintWidth < m_lVidWidth )uintWidth = uintWidth << 1;
while( (LONG)uintHeight < m_lVidHeight