I am in the process of making a dynamic texture using LockRect() which is all working well. Except the boundaries of the rectangle are not being enforced.
I have specified the 'rect' to be 8x8 (so a total of 64 pixels).
With the following code I would expect it to give me an 8x8 white cube. But, all I get is a single line that is 64 pixels long.
RECT rect;
rect.top=0;
rect.left=0;
rect.right=8;
rect.bottom=8;
D3DLOCKED_RECT lockedRect={0};
hr=mRenderer->textureVideoGet()->LockRect(0,&lockedRect,&rect,0);
if(FAILED(hr))
{
std::cout<<hr<<"\r\n";
system("PAUSE");
return 0;
}
unsigned char* bytes=(unsigned char*)lockedRect.pBits;
for(i=0;i<64*4;i++) // 64*4 = 4 bits per pixel ARGB
{
bytes[i]=255; //b
bytes[i+1]=255; //g
bytes[i+2]=255; //r
bytes[i+3]=255; //a
}
mRenderer->textureVideoGet()->UnlockRect(0);
Any ideas as to why the 'rect' isn't being enforced would be awesome!