Sign in to follow this  

Progress bar rendering

This topic is 4093 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, For our game, I sometimes need to show a progress bar when content is downloaded. I want to do this without continuously rendering the background, but by just taking a screenshot of the window and using that as a background for the progress-bar rendering cyclus. This is only necessary for full-screen as there is swapping. In windowed mode, I can just draw over the last rendered frame without clearing the backbuffer. So I: ... m_pD3DDevice->CreateTexture(resx,resy,1,0,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,&m_texBBCopy,NULL); ... ... IDirect3DSurface9 *srfBBCopy; IDirect3DSurface9 *srfBackBuffer; if (FAILED(hr=m_texBBCopy->GetSurfaceLevel(0,&srfBBCopy))) throw DException(hr,"RenderProgress - Failed to GetSurfaceLevel"); if (FAILED(hr=m_pD3DDevice->GetFrontBufferData(0,srfBBCopy))) throw DException(hr,"Failed to GetFrontBufferData"); // Repeat this for backbuffer-count if (FAILED(hr=m_pD3DDevice->GetBackBuffer(0,ibb,D3DBACKBUFFER_TYPE_MONO,&srfBackBuffer))) throw DException(hr,"RenderProgress - Failed to GetBackBuffer 0"); if (FAILED(hr=m_pD3DDevice->UpdateSurface(srfBBCopy,NULL,srfBackBuffer,NULL))) throw DException(hr,"RenderProgress - Failed to UpdateSurface 0"); // End repeat srfBackBuffer->Release(); srfBBCopy->Release(); Now, the code fails on GetFrontBufferData with the cryptic error: D3DERR_INVALIDCALL Can anyone tell me what I'm doing wrong?

Share this post


Link to post
Share on other sites
Quote:
Original post by darkelf2k5
srfBBCopy has to be a valid surface, not just an empty pointer afaik. Create a surface with the size of the backbuffer.


Hi,

The surface is not invalid afaik, I created a texture earlier and I get a surface from that texture with GetSurfaceLevel.

Share this post


Link to post
Share on other sites
Missed that, my bad.

Well, it works for me if I create the surface like this:

dxutGetD3DDevice()->CreateOffscreenPlainSurface( D3DPP.BackBufferWidth, D3DPP.BackBufferHeight, D3DPP.BackBufferFormat, D3DPOOL_SYSTEMMEM, pFrontBufferData, NULL );

Try using SYSTEMMEM pool. Or CreateOffscreenPlainSurface instead of getting it from a texure.

Cheers

Share this post


Link to post
Share on other sites
Quote:
Original post by darkelf2k5
Try using SYSTEMMEM pool. Or CreateOffscreenPlainSurface instead of getting it from a texure.


Of course!! That must be it! I even read that part in the SDK stating that the surface should be in system memory.
How stupid of me!

Thanks dude!

Share this post


Link to post
Share on other sites

This topic is 4093 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.

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