UpdateSurface

Started by
5 comments, last by Ataru 20 years, 6 months ago
I need help with update surface. I am getting invalid data errors, but I've followed the internal docs precisley. This is what I do:

hr = D3DXCreateTextureFromFileEx( m_pd3dDevice, "1.TGA", D3DX_DEFAULT, D3DX_DEFAULT, 0, 0,D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0,NULL,NULL,&textures[0]);

hr = D3DXCreateTextureFromFileEx( m_pd3dDevice, "1.TGA",D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_SYSTEMMEM, D3DX_DEFAULT, D3DX_DEFAULT, 0,NULL,NULL, &textures[1]);

IDirect3DSurface9 *srcSurface;

IDirect3DSurface9 *dstSurface;

textures[0]->GetSurfaceLevel(0,&srcSurface);

textures[1]->GetSurfaceLevel(0,&dstSurface);

hr =  m_pd3dDevice->UpdateSurface (srcSurface,NULL,dstSurface,NULL);

if (hr != D3D_OK)
  LOG("ERROR: TEXTURE BLIT %x\n",hr);

hr always returns D3DERR_INVALIDCALL. What am I doing wrong? It's the same file (just want to get it to work at this point) so all the formats and sizes should be the same. The memory format is as DirectX expects it. What am I doing wrong? [edited by - ataru on October 7, 2003 1:32:52 PM]
Advertisement
BAH! Stupid me, just had to flip source and dst.

I still wish DirectX would provide a slightly better error lookup.
Debug output would''ve catched invalid src and dest surfaces.

-Nik

Niko Suni

How do you get debug output? Do you have to define some flag?
Change to the Debug runtime in Control Panel -> DirectX. Crack up the error output all the way. Run DXSDK\bin\DXUtils\dbmon.exe. Have fun.
.. or simply run your executable through VS'' debugger and watch the output window (after enabling debug output in dx control panel, of course)
Thanks guys, that helps a lot

This topic is closed to new replies.

Advertisement