|
|
发表于 2006-4-6 10:39:00
|
显示全部楼层
Re:请教一个DX下动态纹理的问题。。
D3DLOCKED_RECT LockRect;
(m_d3dTexture)->LockRect(0,&LockRect,NULL,0);
DWORD* p;
p = (DWORD*)LockRect.pBits;
int pitch4 = LockRect.Pitch/4;
currentColor = colorBase;
for(int i = 0 ; i < textureDesc.Height ; i++ )
{
for(int j = 0 ; j < textureDesc.Width ; j++ )
{
//transform to D3DFMT_X8R8G8B8:
p[i*pitch4+j] = int(currentColor[0]<<24) + int(currentColor[1]<<16) +
int(currentColor[2]<<8) + currentColor[3];
currentColor+=4;
}
}
m_d3dTexture->UnlockRect(0); |
|