|
|
LPDIRECT3DTEXTURE9 pFilteredImage;
D3DLOCKED_RECT d3dlr;
pFilteredImage->LockRect(0,&d3dlr,NULL,0);
for (y=0;y<surface_desc.Height;y++)
{
void* pSurfData=(BYTE*)d3dlr.pBits+d3dlr.Pitch*y;
memcpy(pBuf,pSurfData,dwLineSize);
pBuf+=dwLineSize;
}
pFilteredImage->UnlockRect(0);
d3dlr.Pitch的值怎么总是0啊
纹理使用D3DPOOL_DEFAULT创建的是不能Lock的~~~
Using Dynamic Textures
To find out if the driver supports dynamic textures, check the D3DCAPS2_DYNAMICTEXTURES flag of the D3DCAPS9 structure.
Keep the following things in mind when working with dynamic textures.
They cannot be managed. For example, their pool cannot be D3DPOOL_MANAGED.
Dynamic textures can be locked, even if they are created in D3DPOOL_DEFAULT.
D3DLOCK_DISCARD is a valid lock flag for dynamic textures.
It is a good idea to create only one dynamic texture per format and possibly per size. Dynamic mipmaps, cubes, and volumes are not recommended because of the additional overhead in locking every level. For mipmaps, D3DLOCK_DISCARD is allowed only on the top level. All levels are discarded by locking just the top level. This behavior is the same for volumes and cubes. For cubes, the top level and face 0 are locked.
|
|