|
|

楼主 |
发表于 2005-4-21 14:12:00
|
显示全部楼层
谢谢各位的帮忙.不过如下代码还是不行,还是出现黑,图片
//
void render(void)
{
// This will hold the back buffer
IDirect3DSurface9* backbuffer = NULL;
// Check to make sure you have a valid Direct3D device
if( NULL == pd3dDevice )
return;
D3DXIMAGE_INFO info;
D3DDISPLAYMODE displaymode;
pd3dDevice->GetDisplayMode(NULL,&displaymode);
D3DXGetImageInfoFromFile("c:\ttt.bmp",&info); // Clear the back buffer to a blue color
IDirect3DSurface9* surface;
HRESULT hResult =pd3dDevice->CreateOffscreenPlainSurface(
info.Width, info.Height,displaymode.Format,
D3DPOOL_DEFAULT,
&surface,
NULL);
// Check the return value to make sure that this function call was successful
if (FAILED(hResult))
hResult=NULL;
HRESULT Result = D3DXLoadSurfaceFromFile( surface,
NULL,
NULL,
"C:\ttt.bmp",
NULL,
D3DX_DEFAULT,
0,
NULL );
if ( FAILED(Result ) )
Result= NULL;
// Get the back buffer
pd3dDevice->GetBackBuffer( 0,
0,
D3DBACKBUFFER_TYPE_MONO,
&backbuffer );
// Copy the offscreen surface to the back buffer
// Note the use of NULL values for the source and destination RECTs
// This ensures a copy of the entire surface to the back buffer
pd3dDevice->StretchRect( surface,
NULL,
backbuffer,
NULL,
D3DTEXF_NONE );
//Present the back buffer contents to the display
pd3dDevice-> resent( NULL, NULL, NULL, NULL );
} |
|