IDirectDrawSurface9 to Texture

Started by
2 comments, last by weasalmongler 18 years, 8 months ago
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
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(...);
--X
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.
Excellent, thanks guys, I'll give it a go tonight.

- James

This topic is closed to new replies.

Advertisement