Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Screenshot with Timestamp


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 ProgrammerDX   Members   -  Reputation: 197

Like
0Likes
Like

Posted 27 October 2013 - 12:16 PM

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



Sponsor:

#2 N.I.B.   Members   -  Reputation: 1262

Like
0Likes
Like

Posted 27 October 2013 - 12:23 PM

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



#3 ProgrammerDX   Members   -  Reputation: 197

Like
0Likes
Like

Posted 27 October 2013 - 02:21 PM

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



#4 cozzie   Members   -  Reputation: 2321

Like
0Likes
Like

Posted 28 October 2013 - 03:08 PM

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)



#5 ProgrammerDX   Members   -  Reputation: 197

Like
0Likes
Like

Posted 28 October 2013 - 04:55 PM

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, 28 October 2013 - 05:03 PM.


#6 ProgrammerDX   Members   -  Reputation: 197

Like
0Likes
Like

Posted 01 November 2013 - 01:39 PM

It didn't make any difference...






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS