Jump to content
  • Advertisement
Sign in to follow this  
wease

Anyone know why I get an error when using GetDC on a backbuffer?

This topic is 4816 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 am getting an ERR_INVALIDCALL error when I call GetDC. I've tried with the endscene after the getdc call as well. Makes no difference. I'm still a beginner with directx so this error might be really obvious. Here is my code ... gD3dDevice->EndScene(); IDirect3DSurface9 *BackBuffer; gD3dDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&BackBuffer); HDC hdc; BackBuffer->GetDC(&hdc); ... Any ideas what the problem is?

Share this post


Link to post
Share on other sites
Advertisement
From the SDK Docs:
Quote:
The following restrictions apply.

IDirect3DSurface9::GetDC is valid on the following formats only: D3DFMT_R5G6B5, D3DFMT_X1R5G5B5, D3DFMT_R8G8B8, and D3DFMT_X8R8G8B8. Formats that contain Alpha are not supported because the Microsoft Windows Graphics Device Interface (GDI) implementations don't have a well-defined behavior on the alpha channel. For more information about formats, see D3DFORMAT.
Only one device context per surface can be returned at a time.
IDirect3DSurface9::GetDC will fail if the surface is already locked. If the surface is a member of a mipmap or cubemap, IDirect3DSurface9::GetDC fails if any other mipmap or cubemap member is locked.
IDirect3DSurface9::GetDC fails on render targets unless they were created lockable (or, in the case of back buffers, with the D3DPRESENTFLAG_LOCKABLE_BACKBUFFER flag).
For surfaces not created with IDirect3DDevice9::CreateOffscreenPlainSurface, IDirect3DSurface9::GetDC will fail on default pool (D3DPOOL_DEFAULT) surfaces unless they are dynamic (D3DUSAGE_DYNAMIC) or are lockable render targets.
IDirect3DSurface9::GetDC will fail on D3DPOOL_SCRATCH surfaces.

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!