Thanks Hodgman, compiles fine now. But, all I get is a black screen that is flickering my framerate counter (FPS is the last thing drawn in the render process).
I am not getting any errors from (FAILED) though.
This is my draw call. I have simplified it for debugging purposes, so in theory I should get a shot blue line rendered (if I am correct).
RECT rect={0,640,0,480};
D3DLOCKED_RECT lockedRect={0};
hr=mRenderer->textureVideoGet()->LockRect(0,&lockedRect,&rect,0);
if(FAILED(hr))
{
std::cout<<"Error: "<<hr<<"\r\n";
system("PAUSE");
return 0;
}
unsigned char* bytes=(unsigned char*)lockedRect.pBits;
for(i=0;i<20;i=i+4)
{
bytes[i]=255;
bytes[i+1]=0;
bytes[i+2]=0;
bytes[i+3]=255;
}
mRenderer->textureVideoGet()->UnlockRect(0);
// render the sprite queue
mRenderer->renderSpriteQueue();
// display framerate data
lps=mRenderer->framerateGetReal();
lps=lps-1;
if(lps<0)
lps=0;
itoa(lps,szBuffer,10);
strcpy(szBuffer2,"Frame Rate: ");
strcat(szBuffer2,szBuffer);
strcat(szBuffer2," FPS");
mRenderer->renderDebugText(14,14,szBuffer2);
Is it something to do with how I am creating the texture?
// Sprite renders ok with this texture
if(FAILED(D3DXCreateTextureFromResourceA(d3dDevice,GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_PNG1),&pTexture)))
MessageBox(0,"Can not find file","Resource not found",0);
// Sprite won't work with this texture
if(FAILED(D3DXCreateTexture(d3dDevice,1024,1024,0,NULL,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,&pVideoTexture)))
MessageBox(0,"Can not create blank video texture","Resource not found",0);
Any additional help would be awesome.
BTW, I am a newbie when it comes to dynamic textures and locking (never done it before).