0

I have a directx9 device for separate windows. One of the windows has a rendered image on it. What I would like to do is actually take Device 'A' image and place the texture on Device 'B's texture. Is this possible?

I was trying to figure out why the below code did not work and its because StretchRect only works with the specified device you are trying to use.

Below code will not work:

D3DXCreateTexture ( B , 32 , 32 , 1 , D3DUSAGE_RENDERTARGET , D3DFMT_A8R8G8B8 , D3DPOOL_DEFAULT , &Texture );

IDirect3DSurface9 *backBufferSucrface;
Texture ->GetSurfaceLevel ( 0 , &backBufferSucrface );

IDirect3DSurface9* backBufferCurrect;
A->GetBackBuffer ( 0 , 0 , D3DBACKBUFFER_TYPE_LEFT , &backBufferCurrect );

B->StretchRect ( backBufferCurrect , 0 , backBufferSucrface , 0 , D3DTEXF_LINEAR );

backBufferCurrect->Release();

I would love to be able to do this, but if this is not possible, is there any way I could use just use one device and render to multiple windows?

User
  • 659
  • 2
  • 12
  • 29

1 Answers1

0

Starting from vista d3d9 supports resources sharing between devices. http://msdn.microsoft.com/en-us/library/windows/desktop/bb219800(v=vs.85).aspx#Sharing_Resources

Dave
  • 356
  • 1
  • 7
  • 1
    I did some research and it looks like D3DXLoadSurfaceFromSurface does the trick really well. Ill accept anyhow since it relates to the other question. – User Jan 06 '13 at 06:03