|
- void CRender::InitData()
- {
- unsigned int* pBmpData = NULL;
- CYap yap;
- yap.OpenYap("test.yap");
- // 这里的pBmpData数据读取没有问题的,已测试过可以正常保存tga图片.32位的
- yap.UnPackYas(&pBmpData, m_Width, m_Height, 1, 1, 2);
- int bmpSize = m_Width*m_Height*4;
-
- m_pD3DDevice->CreateTexture(m_Width, m_Height, 0, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
- &m_pTexture, NULL);
-
- D3DLOCKED_RECT lrect;
- HRESULT hr = m_pTexture->LockRect(0, &lrect, NULL, 0/*|D3DLOCK_NO_DIRTY_UPDATE*/);
- if (FAILED(hr))
- {
- m_pTexture->UnlockRect(0);
- return;
- }
-
- memcpy(lrect.pBits, pBmpData, bmpSize);
-
- m_pTexture->UnlockRect(0);
- }
复制代码
应该怎么LockRect像素? |
|