Jump to content
  • Advertisement
Sign in to follow this  
ProgrammerDX

Screenshot with Timestamp

This topic is 1717 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

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)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!