Jump to content
  • Advertisement

Archived

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

Prairie

Windowed Backbuffer problem

This topic is 6559 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 writing a windowed application that uses direct x7. for some reason when I add a backbuffer it fails to create the primary surface?? has anyone encountered this before. Any advice would be appreciated. here''s the code. DirectDrawCreateEx(NULL,(VOID**)&g_pDD,IID_IDirectDraw7,NULL); g_pDD->SetCooperativeLevel( hwnd, DDSCL_NORMAL); g_pDD->CreateClipper(NULL,&g_pddClipper,NULL); g_pddClipper->SetHWnd(0,hwnd); //primary surface DDSURFACEDESC2 desc; ZeroMemory(&desc, sizeof(desc)); desc.dwSize = sizeof(desc); desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; desc.dwBackBufferCount = 1; if(FAILED(g_pDD->CreateSurface(&desc,&g_pPrimary,NULL))) { MessageBox(hwnd,"Couldn''t create Primary",NULL,NULL) ; } g_pPrimary->SetClipper(g_pddClipper); DDSCAPS2 ddscaps; ddscaps.dwCaps = DDSCAPS_BACKBUFFER; if(FAILED(g_pPrimary->GetAttachedSurface(&ddscaps,&g_pBack))) { MessageBox(hwnd,"BackBuffer Not Attached",NULL,NULL) ; } thanks in advance Prairie

Share this post


Link to post
Share on other sites
Advertisement
Unfortunately, you can''t page-flip in windowed mode--only in exclusive (fullscreen). I think it''s because if you moved the video pointer around while windowed, it would screw up the video for any other windowed applications on your desktop. Try making an offscreen surface and using that for your doublebuffer--although when I''ve tried it it''s really slow, but that''s probably my coding

Share this post


Link to post
Share on other sites
quote:
Original post by SkyDruid
Try making an offscreen surface and using that for your doublebuffer--although when I''ve tried it it''s really slow, but that''s probably my coding



If you try to make two offscreen surfaces for a buffer, and you get really slow results ( as long as you''re not locking surfaces), it''s a pretty safe bet that one surfaces is in vid mem while the other in system, this is extremely slow.

Try creating all surfaces (including primary and buffer) with the DDSCAPS_SYSTEMMEMORY (for your only memory flag) set, you will be surprized at the results when using surfaces less than 640x480 (for that size and higher I would go for dirty rectangles).

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!