I have this set of code
Code:
LPDIRECTDRAW7 lpdd; //version 7.0 main
DDSURFACEDESC2 ddsd; //primary surface descriptor
LPDIRECTDRAWSURFACE7 DDprimary; //DX primary surface
LPDIRECTDRAWSURFACE7 DDback; //DX BACK surface...
///init the the DD stuff here....
///
///
///
//lock the surface
DDback->Lock(NULL,&ddsd,DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
//valuse are valid now
int mempitch = (int)(ddsd.lPitch >> 2);
UINT *video_buffer = (UINT *)ddsd.lpSurface;
if(ddsd.lPitch == 800) //linear memory
{
memset(video_buffer,0,800*600);
}
else //BOOO! non-linear memory
{
UINT *dest_ptr = video_buffer;
for(int i=0;i<600;i++)
{
//clear nxt line
memset(dest_ptr,0,600);
//advance ptr
dest_ptr += (UNIT)mempitch;
}
}
for(int i = 0; i<1000;++i)
{
x = rand()%800;
y = rand()%600;
red = rand()%256;
blue = rand()%256;
green = rand()%256;
Plot_Pixel32(x,y,0,red,green,blue,video_buffer,mempitch);
}
//unlock the surface
DDback->Unlock(NULL);
//flip
while(FAILED(DDprimary->Flip(NULL,DDFLIP_WAIT)));
but it only clears out the very left most 1/5 of the screen, the rest is a flickery mess, and is never cleared.
Its 32-bit, 800x600 mode
Thank you very much
DW