Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5509 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

Does has anyone here gotten the GetFrameData method to work? It''s telling me I have an invalid param, and because I can get my Swap Chain correctly, I''m assuming it''s the surface I''m passing, but I''ve tried a numb er of thigs to get this to work, and all fail, I''ve tried just getting a surface pointer to the backbuffer and just using that, I''ve tried creating a surface the size of my desktop, I''ve evne tried running the app in fuulscreen and debugging it, which doesn''t work much, any thoughts?

Share this post

Link to post
Share on other sites
Here''s one possible answer to your second question: You''re posting in the DirectX forum, so it''s presumable that the function you''re talking about is a DirectX function. However, a search of my local DirectX documentation doesn''t show anything, a search of MSDN online doesn''t list GetFrameData() and a grep of my include files only lists GetFrameData() as a commented out function for IGetFrame, an interface that has been obsolete for something like five years.

So, yes, it''s entirely possible that no one knows how to use it.

Share this post

Link to post
Share on other sites
Sorry, let me be more clear, the method is IDirect3DDevice9::GetFrontBufferData( UINT iSwapChain,
IDirect3DSurface9 *pDestSurface ), my mistake. The function is current, so it should work, I''m just having trouble creating a plane that doesn''t cause it to fail.

Share this post

Link to post
Share on other sites
From my code:

/ Name: TakeScreenShot
/ Type: Function
/ Desc: Takes a screen shot and store it in an image file.
/ Version: 0.4a

HRESULT CWhiteHawkEngine::TakeScreenShot(std::string strFilename, UINT nScreenX, UINT nScreenY,
D3DXIMAGE_FILEFORMAT imageType, bool bAll)
LPDIRECT3DSURFACE9 frontbuf = NULL; //this is our pointer to the memory location containing our copy of the

//front buffer

/* Create a surface for the screenshot to be rendered to */
if( FAILED( hr = m_pd3dDevice->CreateOffscreenPlainSurface( nScreenX, nScreenY,
D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &frontbuf, NULL ) ) )
return hr;

/* Write the front buffer (A.K.A. screen) to the surface */
if( FAILED( hr = m_pd3dDevice->GetFrontBufferData( 0, frontbuf ) ) )
//do error handling etc...


// Here I should blt a alpha of the NNG Logo

/* Save the surface to a file */
if( bAll )
D3DXSaveSurfaceToFile( strFilename.c_str(), imageType, frontbuf, NULL, NULL );
Currently can't do partial scrren shots. When I di it will be only
for windowed mode and only the window.

return E_FAIL;

/* Cleanup */

return S_OK;

So... you need to create the surface as so:

CreateOffscreenPlainSurface( nScreenX, nScreenY, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &frontbuf, NULL )

[edited by - Newfound Ajarn on November 11, 2003 11:26:52 PM]

Share this post

Link to post
Share on other sites
Thanx, I was beginning to give up on this, but it works now, I''m thinking the difference may be using D3DPOOL_SCRATCH for the surface, I dunno, but it works now.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!