Advertisement Jump to content


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


can window mode create back buffer?

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

Can window mode create back buffer? I have try the follow code, but it does work. Is window mode cannot create back buffer or some mistakes occur in the program?
m_pDD->SetCooperativeLevel(m_hWnd, DDSCL_NORMAL);


ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwBackBufferCount = 1;

m_pDD->CreateSurface(&ddsd, &m_lpPrimary, NULL);

ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
m_lpPrimary->GetAttachedSurface(&ddsd.ddsCaps, &m_lpBackBuffer);

Share this post

Link to post
Share on other sites
check for error values.

or try flipping the back buffer,
it wont work...

{ Stating the obvious never helped any situation !! }

Share this post

Link to post
Share on other sites
Hmm, Im primarily 3D, but when I can''t create a backbuffer it means that the format that Im creating it in isn''t supported by the video card? Can this be a clue?

"Programming is like sex make one mistake, and you have to support it forever."

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Hi, I suppose you should do something like this:

RECT *r = new RECT;
GetClientRect( m_hWindow, r );
ZeroMemory( &ddsd, sizeof( ddsd ) );
ddsd.dwSize = sizeof( ddsd );
ddsd.dwWidth = r->right - r->left;
ddsd.dwHeight = r->bottom - r->top;
delete r;
hRetVal = m_lpddDirectDraw->CreateSurface( &ddsd, &m_lpdsBackBuff, NULL );

This code creates a backbuffer on which you can Blt() something later.

Share this post

Link to post
Share on other sites
ic. I can do that. Thank you.
I have another question about display GDI under full screen mode

I have two buttons in a window, i want to display those under fullscreen mode:

MyButton button1 = new MyButton(....); //<- This is button class that i made using CreateWindow("Button".....)

MyButton button2 = new MyButton(....);

pDD->CreateClipper(0, &ddClipper, NULL);
ddClipper->SetHWnd(0, hWnd);

void TimerDraw() //<- this function for timer to call

lpPrimary->Blt(NULL, lpBackBuffer, NULL, DDBLT_WAIT, NULL);

i set a timer and it will call TimerDraw function to display content at each second. However, the button can only display one times and then never display. Why? And how can i solve it?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!