Skip to main content
gamedev.net
🔒 Locked

Windowed Backbuffer problem

Started by Prairie Aug 31, 2000 at 11:44 AM 1 replies 300+ views
Original Post
Prairie
Prairie
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
SkyDruid
SkyDruid
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
iwasbiggs
iwasbiggs
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).
___________________________Freeware development:ruinedsoft.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.