本文整理汇总了C++中LPDIRECT3DDEVICE7::GetCaps方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE7::GetCaps方法的具体用法?C++ LPDIRECT3DDEVICE7::GetCaps怎么用?C++ LPDIRECT3DDEVICE7::GetCaps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE7
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE7::GetCaps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wGetCaps
/// <summary>
/// <c>wGetCaps</c>
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="d3dDevice7"></param>
/// <param name="lpD3DHWDevDesc"></param>
/// <returns></returns>
HRESULT __stdcall wGetCaps(
LPDIRECT3DDEVICE7 d3dDevice7, LPD3DDEVICEDESC7 lpD3DHWDevDesc)
{
PSTR pszErrorMessage;
HRESULT hResult;
InternalFunctionSpew("GameOS_Direct3D", "GetCaps(0x%x)", d3dDevice7);
hResult = d3dDevice7->GetCaps(lpD3DHWDevDesc);
if (FAILED(hResult))
{
pszErrorMessage = ErrorNumberToMessage(hResult);
if ( InternalFunctionPause("FAILED (0x%x - %s) - GetCaps(0x%x)", hResult, pszErrorMessage, d3dDevice7) )
ENTER_DEBUGGER;
}
return hResult;
}
示例2: Restore
HRESULT CTextureHolder::Restore( LPDIRECT3DDEVICE7 pd3dDevice )
{
// Release any previously created objects
SAFE_RELEASE( m_pddsSurface );
// Check params
if( NULL == pd3dDevice )
return DDERR_INVALIDPARAMS;
// Get the device caps
D3DDEVICEDESC7 ddDesc;
if( FAILED( pd3dDevice->GetCaps( &ddDesc) ) )
return E_FAIL;
// Setup the new surface desc
DDSURFACEDESC2 ddsd;
D3DUtil_InitSurfaceDesc( ddsd );
ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|
DDSD_PIXELFORMAT|DDSD_TEXTURESTAGE;
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.dwTextureStage = 0; //m_dwStage;
ddsd.dwWidth = m_dwWidth;
ddsd.dwHeight = m_dwHeight;
// Turn on texture management for hardware devices
if( ddDesc.deviceGUID == IID_IDirect3DHALDevice )
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE;
else if( ddDesc.deviceGUID == IID_IDirect3DTnLHalDevice )
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE;
else
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
// Adjust width and height to be powers of 2, if the device requires it
if( ddDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2 )
{
for( ddsd.dwWidth=1; m_dwWidth>ddsd.dwWidth; ddsd.dwWidth<<=1 );
for( ddsd.dwHeight=1; m_dwHeight>ddsd.dwHeight; ddsd.dwHeight<<=1 );
}
// Limit max texture sizes, if the driver can't handle large textures
DWORD dwMaxWidth = ddDesc.dwMaxTextureWidth;
DWORD dwMaxHeight = ddDesc.dwMaxTextureHeight;
ddsd.dwWidth = min( ddsd.dwWidth, ( dwMaxWidth ? dwMaxWidth : 256 ) );
ddsd.dwHeight = min( ddsd.dwHeight, ( dwMaxHeight ? dwMaxHeight : 256 ) );
// Make the texture square, if the driver requires it
if( ddDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY )
{
if( ddsd.dwWidth > ddsd.dwHeight ) ddsd.dwHeight = ddsd.dwWidth;
else ddsd.dwWidth = ddsd.dwHeight;
}
// Setup the structure to be used for texture enumration.
TEXTURESEARCHINFO tsi;
tsi.bFoundGoodFormat = FALSE;
tsi.pddpf = &ddsd.ddpfPixelFormat;
tsi.dwDesiredBPP = m_dwBPP;
tsi.bUsePalette = ( m_dwBPP <= 8 );
tsi.bUseAlpha = m_bHasMyAlpha;
if( m_dwFlags & D3DTEXTR_16BITSPERPIXEL )
tsi.dwDesiredBPP = 16;
else if( m_dwFlags & D3DTEXTR_32BITSPERPIXEL )
tsi.dwDesiredBPP = 32;
if( m_dwFlags & (D3DTEXTR_TRANSPARENTWHITE|D3DTEXTR_TRANSPARENTBLACK) )
{
if( tsi.bUsePalette )
{
if( ddDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE )
{
tsi.bUseAlpha = TRUE;
tsi.bUsePalette = TRUE;
}
else
{
tsi.bUseAlpha = TRUE;
tsi.bUsePalette = FALSE;
}
}
}
// Enumerate the texture formats, and find the closest device-supported
// texture pixel format
pd3dDevice->EnumTextureFormats( TextureSearchCallback, &tsi );
// If we couldn't find a format, let's try a default format
if( FALSE == tsi.bFoundGoodFormat )
{
tsi.bUsePalette = FALSE;
tsi.dwDesiredBPP = 16;
pd3dDevice->EnumTextureFormats( TextureSearchCallback, &tsi );
// If we still fail, we cannot create this texture
if( FALSE == tsi.bFoundGoodFormat )
return E_FAIL;
}
// Get the DirectDraw interface for creating surfaces
LPDIRECTDRAW7 pDD;
LPDIRECTDRAWSURFACE7 pddsRender;
//.........这里部分代码省略.........