Original Post
I'm having an odd problem with SurfaceLoader.FromSurface() or SurfaceLoader.FromFile() in C#.
If I declare a source rectangle offset from the point 0,0 I often have an error, even if that rectangle is properly contained by the surface. Let me show an example.
In this situation, I have a Surface loaded in memory which is 2048x2048 called _mainSurface or (in C++) pSurface.
C# Version
Texture tempTexture = new Texture(_device, 256, 256, 1, 0, _mainSurface.Description.Format, Pool.Managed); Rectangle srcRect = new Rectangle(0, 256, 256, 256); Surface tempSurface = tempTexture.GetSurfaceLevel(0); SurfaceLoader.FromSurface(tempSurface, _mainSurface, srcRect, Filter.None, 0); The above version craps out saying that the rectangle has "zero area" (when obviously it does not). C++ Version LPDIRECT3DTEXTURE9 tempTexture; Rectangle srcRect; D3DXCreateTexture(m_pDevice, 256, 256, 1, 0, srcInfo.Format, D3DPOOL_MANAGED, &tempTexture); RECT srcRect; srcRect.left = 0; srcRect.right = 256; srcRect.top = 256; srcRect.bottom = 512; LPDIRECT3DSURFACE9 pTempSurface; tempTexture->GetSurfaceLevel(0, &pTempSurface); D3DXLoadSurfaceFromSurface(pTempSurface, NULL, NULL, pSurface, NULL, &srcRect, D3DX_FILTER_NONE, 0);In C++, the above works flawlessly. My tempTexture is now correctly set. It is essentially the same method taking the exact same rectangle from the exact same surface. Anyone know what's going on? [edited by - The Frugal Gourmet on August 3, 2003 12:51:40 AM]