Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

farhanx

Non Linear Algo Versus bilitter

This topic is 5242 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

As i heard that when we use BLT function then we doesnt need to care about cleaning of the surfaces means we dont have to create non linear algo to clean memory... But when i use flipping and i want to copy the secondry surface stuff to primary surface then i see bad output with so many strange line on half of the screen. But when i use non linear algo to clean the memory then it works perfectly fine. So is it true that biliter function is also not capable to clean non linear memory??? here is the code inside the winmain function................... if ((video_buffer = (USHORT *)malloc(640*480))==NULL) return(0); int x=0,y=0; //ZeroMemory(video_buffer,sizeof(video_buffer)); memset(&tfx,0,sizeof(DDBLTFX)); tfx.dwSize=sizeof(tfx); tfx.dwFillColor=(USHORT)RGB16BIT(255,0,0); areas.top=34; areas.left=12; areas.right=88; areas.bottom=66; while(TRUE) { USHORT *dest_ptr = NULL, *src_ptr= NULL; if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if (msg.message ==WM_QUIT) break; if (msg.message ==WM_CLOSE) break; //translate any accelerator keys if(KEY_UP(VK_ESCAPE)) //MessageBox(NULL,"HEY YOU","WHAT",MB_OK); break; TranslateMessage(&msg); //send the message to the window proc DispatchMessage(&msg); } tfx.dwFillColor=(USHORT)RGB16BIT(rand()%255,rand()%255,rand()%255); // erase secondary back buffer //memset(&ddsd,0,sizeof(ddsd)); //ddsd.dwSize = sizeof(ddsd); secondS->Lock(NULL,&ddsd,DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT,NULL); video_buffer=(USHORT *)ddsd.lpSurface; //////////////////////////////////////////////////////////////////////////// //########################################################################// /////// Checking linear or non linear memory to clean surface/////////////////////// if (ddsd.lPitch == 640) {memset(video_buffer,0,640*480);} else { // non-linear memory // make copy of video pointer dest_ptr = video_buffer; for (int y=0; y<480; y++) { // clear nect line memset(dest_ptr,0,640*16); dest_ptr+=ddsd.lPitch; } // end for y } // end else //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// secondS->Unlock(NULL); secondS->Blt(&areas,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&tfx); //primaryS->Blt(&areas,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&tfx); if(areas.right<640) {areas.right++; } else if(areas.bottom<480) { areas.bottom++; } while(primaryS->Flip(NULL,DDFLIP_WAIT)!=DD_OK); Sleep(1); }//End while

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!