Double buffer window

Started by
1 comment, last by eltri 21 years, 8 months ago
Hi, This is a newbie question... I want to have a double-buffered window that is not the full screen size. However, I keep getting an error when creating the directdraw surface unless i set the cooperative level to DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN. For a single buffered window, I can run on DDSCL_NORMAL, but for the double buffered window it seems that I need to do this. However, when I run my program, the entire screen is now taken up by my program as opposed to the small OVERLAPPED window I want. It seems that I cannot run DDSCL_EXCLUSIVE without DDSCL_FULLSCREEN. Does anyone have any ideas on how to do this the right way? Thanks in advance! -Eltri
Advertisement
You cannot have exclusive control of the primary surface (which is the entire desktop in windowed mode) since other applications are being rendered also. The only flag you should need to use is DDSCL_NORMAL.

If it still isn''t working try finding out which error DirectDraw is returning. They can be very informative.



[Edited by - JonW on March 15, 2007 8:32:45 AM]
Its quite simple, Direct Draw cannot create/attactch backbuffers to surfaces in Normal Mode. So you Cant use the backbuffer flag or set backbuffer count.

So you have to create an offscreen plain the Size of primary surface and Blt it to primary surface .


ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT ;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
ddsd.dwWidth = WIDTH_OF_PRIMARY;
ddsd.dwHeight = HEIGHT_OF_PRIMARY;


And that is your Backbuffer

[edited by - Daerax on August 14, 2002 10:46:34 PM]

This topic is closed to new replies.

Advertisement