Jump to content
  • Advertisement
Sign in to follow this  
weasalmongler

IDirectDrawSurface9 to Texture

This topic is 4736 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 guys, I've got an IDirect3DSurface9 which contains a copy of back buffer (copied using IDirect3DDevice9::StretchRect(...) ), and I now want to draw this back to the screen as a texture. I have been unable to locate a way of converting the surface to a texture in order to draw it. Does anyone know a way of doing this? Thanks in advance. - James

Share this post


Link to post
Share on other sites
Advertisement
Well did you make a texture and a surface?

get yer back buffer...
m_pd3dDevice->GetBackBuffer(...);

then create the texture...
CreateTexture(...);

then tie it together...
GetSurfaceLevel(...);

check msdn.microsoft.com for info about each... If ya need specifics u cant find just say

ALSO: if u want to make sure its saving correctly, do a:
D3DXSaveTextureToFile(...);

Share this post


Link to post
Share on other sites
The way that I was doing it:

IDirect3DTexture9* m_pBackBuffer = 0;
m_pDevice->CreateTexture(800, 600, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, 0);

IDirect3DSurface9* pSurface = 0;
m_pBackBuffer->GetSurfaceLevel(0, &pSurface);
m_pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pSurface);
pSurface->Release();


I'm not sure if that is the exact code, since I'm on a different computer, but I believe that is the gist of what I was doing.

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!