Sign in to follow this  
ProgrammerDX

Screenshot with Timestamp

Recommended Posts

ProgrammerDX    395

Hi,

 

I'm trying to make a screenshot with a timestamp but for some users they sometimes don't get the timestamp on the image :S

 

From the WndProc I call the CreateScreenshot function which looks as following:

lpD3DDevice->BeginScene();
lpD3DDevice->Clear(ZBUFFER | STENCIL);
 
draw timestamp as text...
 
lpD3DDevice->EndScene();
lpD3DDevice->Present(...);
 
LPDIRECT3DSURFACE9 lpSurface;
lpD3DDevice->GetRenderTarget( 0, &lpSurface );
 
D3DXSaveSurfaceToFile( fileName, D3DXIFF_PNG, lpSurface, 0, 0 );
 
lpSurface->Release();

 

I'm not sure why sometimes this doesn't work. Can it be possible it has to do with the monitor vsync? Like it ignores the new rendered frame..

 

Thanks for reading ;)

Share this post


Link to post
Share on other sites
satanir    1452

So the file is saved correctly, just without the timestamp? Does the timestamp appear in the window?

 

I know that in Win7, if the windows is not active - for example you are on the lock screen - present calls are being ignored(at least in DX10+).

Share this post


Link to post
Share on other sites
ProgrammerDX    395

So the file is saved correctly, just without the timestamp? Does the timestamp appear in the window?

 

I know that in Win7, if the windows is not active - for example you are on the lock screen - present calls are being ignored(at least in DX10+).

The window isn't inactive or locked

 

The users sees the timestamp in-game, its just not saved on the image unsure.png

Share this post


Link to post
Share on other sites
ProgrammerDX    395

Yeah, remember it works for most but not all users.

 

I found this piece of code and I'll try it in next patch to see f it works:  (first answer)

http://stackoverflow.com/questions/5069104/fastest-method-of-screen-capturing

 

In that code, instead of calling D3DXSaveSurfaceToFile() directly on the GetRenderTarget() surface, it first creates an Offscreen Surface and copies the Render Target to the Offscreen Surface using GetRenderTargetData().

 

I don't have any idea why that would be of any benefit over what I'm doing.. but let's see...

Edited by ProgrammerDX

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this