Screenshot with Timestamp

Started by
4 comments, last by ProgrammerDX 10 years, 5 months ago

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 ;)

Advertisement

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+).

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

Maybe a bit simple, but are you 100% sure the timestamp is 'drawn' onto the same surface/ target where the scene is? (which you save/ capture)

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

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...

It didn't make any difference...

This topic is closed to new replies.

Advertisement