从内存创建纹理出错
从内存数据中生成纹理,内存的数据是个24位的纹理图,我读取出来却是不是原来的纹理图。
原来的图(试试外链图):
生成的纹理图却是:
在线等:
if (FAILED(D3DXCreateTexture(TBDevice::GetDevice(),width,height,1,0,D3DFMT_R8G8B8,D3DPOOL_MANAGED,&m_pTexture))) { ::MessageBox(0,"创建空白纹理失败","ERROR",0); return false; } assert(m_pTexture->GetLevelCount() > 0); m_pTexture->GetLevelDesc(0,&m_surfacedesc); D3DLOCKED_RECT lockRect; if(FAILED(m_pTexture->LockRect(0,&lockRect,NULL,0))) { ::MessageBox(0,"LockRect失败","ERROR",0); return false; } memcpy(lockRect.pBits,pSrcData,dataSize); m_pTexture->UnlockRect(0);