Original Post
Hi! I'm having problems with creating a texture from memory. I want to load a simple 8x8 sized image, wich displays a cross, and draw it with d3dxsprite. But instead of a cross a black filled rectangle is displayed. Here is the code what I'm using :
D3DLOCKED_RECT r;
HRESULT hr;
DWORD c0=D3DCOLOR_ARGB(255,0,0,0), c1=D3DCOLOR_ARGB(255,255,255,255);
DWORD *pData,
Image[64]={c0,c0,c0,c1,c0,c0,c0,c0,
c0,c0,c0,c1,c0,c0,c0,c0,
c0,c0,c0,c1,c0,c0,c0,c0,
c1,c1,c1,c1,c1,c1,c1,c0,
c0,c0,c0,c1,c0,c0,c0,c0,
c0,c0,c0,c1,c0,c0,c0,c0,
c0,c0,c0,c1,c0,c0,c0,c0,
c0,c0,c0,c0,c0,c0,c0,c0};
m_pDevice->CreateTexture(8,8,1,D3DUSAGE_DYNAMIC,D3DFMT_A8R8G8B8,D3DPOOL_SYSTEMMEM,&m_pPointTexture,NULL);
hr=m_pPointTexture->LockRect(0,&r,NULL,0);
pData=(DWORD*)r.pBits;
for (int i=0; i<8; i++)
for (int j=0; j<8; j++)
pData[j*8+i]=Image[j*8+i];
m_pPointTexture->UnlockRect(0);
What am I doing wrong?