本文整理汇总了C++中LPDIRECT3DDEVICE8::GetBackBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE8::GetBackBuffer方法的具体用法?C++ LPDIRECT3DDEVICE8::GetBackBuffer怎么用?C++ LPDIRECT3DDEVICE8::GetBackBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE8
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE8::GetBackBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
RageSurface* RageDisplay_D3D::CreateScreenshot()
{
#if defined(XBOX)
return NULL;
#else
/* Get the back buffer. */
IDirect3DSurface8* pSurface;
g_pd3dDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &pSurface );
/* Get the back buffer description. */
D3DSURFACE_DESC desc;
pSurface->GetDesc( &desc );
/* Copy the back buffer into a surface of a type we support. */
IDirect3DSurface8* pCopy;
g_pd3dDevice->CreateImageSurface( desc.Width, desc.Height, D3DFMT_A8R8G8B8, &pCopy );
D3DXLoadSurfaceFromSurface( pCopy, NULL, NULL, pSurface, NULL, NULL, D3DX_DEFAULT, 0 );
pSurface->Release();
/* Update desc from the copy. */
pCopy->GetDesc( &desc );
D3DLOCKED_RECT lr;
{
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = desc.Width;
rect.bottom = desc.Height;
pCopy->LockRect( &lr, &rect, D3DLOCK_READONLY );
}
RageSurface *surface = CreateSurfaceFromPixfmt( FMT_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
ASSERT( surface );
/* We need to make a copy, since lr.pBits will go away when we call UnlockRect(). */
RageSurface *SurfaceCopy =
CreateSurface( surface->w, surface->h,
surface->format->BitsPerPixel,
surface->format->Rmask, surface->format->Gmask,
surface->format->Bmask, surface->format->Amask );
RageSurfaceUtils::CopySurface( surface, SurfaceCopy );
delete surface;
pCopy->UnlockRect();
pCopy->Release();
return SurfaceCopy;
#endif
}
示例2: CreateSurfaceFromPixfmt
RageSurface* RageDisplay_D3D::CreateScreenshot()
{
// Get the back buffer.
IDirect3DSurface8* pSurface;
g_pd3dDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &pSurface );
// Get the back buffer description.
D3DSURFACE_DESC desc;
pSurface->GetDesc( &desc );
// Copy the back buffer into a surface of a type we support.
IDirect3DSurface8* pCopy;
g_pd3dDevice->CreateImageSurface( desc.Width, desc.Height, D3DFMT_A8R8G8B8, &pCopy );
// Aldo_MX: D3DXLoadSurfaceFromSurface requires d3dx8core.h, I replaced it with CopyRects to
// remove this dependency so its possible to compile SM with any DirectX SDK up to Aug 2007
D3DXLoadSurfaceFromSurface( pCopy, NULL, NULL, pSurface, NULL, NULL, D3DX_DEFAULT, 0 );
//g_pd3dDevice->CopyRects( pSurface, NULL, 0, pCopy, NULL );
pSurface->Release();
// Update desc from the copy.
pCopy->GetDesc( &desc );
D3DLOCKED_RECT lr;
{
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = desc.Width;
rect.bottom = desc.Height;
pCopy->LockRect( &lr, &rect, D3DLOCK_READONLY );
}
RageSurface *surface = CreateSurfaceFromPixfmt( PixelFormat_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
ASSERT( surface );
// We need to make a copy, since lr.pBits will go away when we call UnlockRect().
RageSurface *SurfaceCopy =
CreateSurface( surface->w, surface->h,
surface->format->BitsPerPixel,
surface->format->Rmask, surface->format->Gmask,
surface->format->Bmask, surface->format->Amask );
RageSurfaceUtils::CopySurface( surface, SurfaceCopy );
delete surface;
pCopy->UnlockRect();
pCopy->Release();
return SurfaceCopy;
}
示例3: CaptureScreen
HRESULT CaptureScreen(LPDIRECT3DDEVICE8 pDevice, char cPath[])
{
IDirect3DSurface8 *pFrontBuffer;
pDevice->GetBackBuffer(-1,D3DBACKBUFFER_TYPE_MONO,&pFrontBuffer);
return XGWriteSurfaceToFile(pFrontBuffer, cPath);
}