Sign in to follow this  

IDirectDrawSurface9 to Texture

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

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