I was wondering how the heck does someone take a snapshot of their game or other 3d application using the irrlicht engine while its running?
I have seen people show a snapshot of their game in forums, and so it would be easier for others to help if i gave a visual when i have a question.
So if anyone could HELP , PLEASE DO
snap shot
-
- Posts: 206
- Joined: Thu Sep 01, 2005 9:26 pm
- Location: France
May help...
Code: Select all
void irrScreenshot( irr::video::IVideoDriver * driver, bool const & windowed, std::string const & filename )
{
LPDIRECT3DSURFACE9 Surface = 0;
if (windowed)
{
driver->getExposedVideoData().D3D9.D3DDev9->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &Surface);
D3DXSaveSurfaceToFile(filename.c_str(), D3DXIFF_BMP, Surface, NULL, NULL);
}
else
{
int Width = GetSystemMetrics(SM_CXSCREEN);
int Height = GetSystemMetrics(SM_CYSCREEN);
driver->getExposedVideoData().D3D9.D3DDev9->CreateOffscreenPlainSurface(Width, Height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &Surface, NULL);
driver->getExposedVideoData().D3D9.D3DDev9->GetFrontBufferData(NULL, Surface);
D3DXSaveSurfaceToFile(filename.c_str(), D3DXIFF_BMP, Surface, NULL, NULL);
}
Surface->Release();
}
Return to Irrlicht after years... I'm lovin it.
It's hard to be a Man !
Si vis pacem para belum
It's hard to be a Man !
Si vis pacem para belum
ohh, that's nice. Thanks.xterminhate wrote:May help...
Code: Select all
void irrScreenshot( irr::video::IVideoDriver * driver, bool const & windowed, std::string const & filename ) { LPDIRECT3DSURFACE9 Surface = 0; if (windowed) { driver->getExposedVideoData().D3D9.D3DDev9->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &Surface); D3DXSaveSurfaceToFile(filename.c_str(), D3DXIFF_BMP, Surface, NULL, NULL); } else { int Width = GetSystemMetrics(SM_CXSCREEN); int Height = GetSystemMetrics(SM_CYSCREEN); driver->getExposedVideoData().D3D9.D3DDev9->CreateOffscreenPlainSurface(Width, Height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &Surface, NULL); driver->getExposedVideoData().D3D9.D3DDev9->GetFrontBufferData(NULL, Surface); D3DXSaveSurfaceToFile(filename.c_str(), D3DXIFF_BMP, Surface, NULL, NULL); } Surface->Release(); }
-
- Posts: 206
- Joined: Thu Sep 01, 2005 9:26 pm
- Location: France