Jump to content
  • Advertisement


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



This topic is 6720 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

The DDRAW Flip method exchanges the pointer of the BackBuffer with the pointer of the PrimarySurface. Why if I exchange them by hand he does not work? For example: void MyFlip() { pPrimary->Lock(); pBack->Lock(); . . . // retrieve pointers DWORD *Temp = lpBackPn; lpBackPn = lpPrimaryPn; lpPrimaryPn = Temp; pPrimary->Unlock(); pBack->Unlock(); }

Share this post

Link to post
Share on other sites
All you are doing is grabbing copies of pointers to the memory. Just because you decide to copy the value of what was returned for the back buffer into a variable that you call the front buffer, and vice versa, has no effect on the video card whatsoever. All that changes is that you now have erroneous names for the buffers. Changing the names in your program doesn''t change anything on the video card. The DirectDraw flip method, on the other hand, tells the video card to start treating what was the back buffer as the front buffer, and vice versa.

Share this post

Link to post
Share on other sites
Why you would want to do this is beyond me.

Adding to what Kylotan said, too make your own home grown flip routine, you would need to have pointers to pointers. That way when you dereference once, you can change what the pointer points to (vs. the data a.k.a. regular pointer)

It would be more like the following:
(Not tested or compiled!)

void MyFlip(DDsurface **front, DDsurface **back)

DDsurface **Temp = *lpBackPn;
*lpBackPn = *lpPrimaryPn;
*lpPrimaryPn = *Temp;



That should work.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!