Jump to content
  • Advertisement


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


DirectDraw flipping

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

I''m having trouble with flipping for some reason. Instead of taking the back buffer and flipping it onto the primary, it seems to show my window, then it shows the back buffer, then back to the window. So it''s like everytime, i see my window screen, then i flip and see the back buffer, then i flip and see my window screen, etc. It should be flipping the back buffer up to the screen every time. I''m not sure what''s wrong, instead of putting the back buffer to the screen it like swaps the back buffer and the window. When i say window, i mean the white application window. Here is my init code bool DD_OBJ::Init() { LPDIRECTDRAW temp_lpdd = NULL; if(FAILED(DirectDrawCreateEx(0, (void**)&lpdd, IID_IDirectDraw7, 0))) return false; if(FAILED(lpdd->SetCooperativeLevel(MainWindow.hwnd,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT))) return false; if(FAILED(lpdd->SetDisplayMode(800,600,32,0,0))) return false; // Initiate Surfaces DDSURFACEDESC2 surfaceDesc = {0}; ZeroMemory(&surfaceDesc, sizeof(surfaceDesc)); surfaceDesc.dwSize = sizeof(DDSURFACEDESC2); surfaceDesc.dwFlags = DDSD_BACKBUFFERCOUNT | DDSD_CAPS; surfaceDesc.dwBackBufferCount = 1; surfaceDesc.ddsCaps.dwCaps = DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_PRIMARYSURFACE; if(FAILED(lpdd->CreateSurface(&surfaceDesc,&primarySurface,NULL))) { return false; } surfaceDesc.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; if(FAILED(primarySurface->GetAttachedSurface(&(surfaceDesc.ddsCaps),&backSurface))) return false; HDC bSurfDC = NULL; backSurface->GetDC(&bSurfDC); RECT rect = {0,0,800,600}; FillRect(bSurfDC,&rect,(HBRUSH)GetStockObject(BLACK_BRUSH)); backSurface->ReleaseDC(bSurfDC); return true; } and my flip code is void DD_OBJ::Draw() { lpdd->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); primarySurface->Flip(NULL, DDFLIP_WAIT); } If anyone can help, ill be very appreciative

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!