I will try to give you as much solid information on this problem as I can without writing my entire program code here. I have an app that switches between windowed Direct Draw mode and exclusive full screen mode. If I start the program in full screen mode, the program works great. But if I start the program in windowed mode, every thing works until I try to blit to the backbuffer or primary surface. This seems strange to me, because the code is essentially the same as full screen mode except for the primary surface allocation and blitting. The funny thing is it will blit once through the loop then freeze, so I get an accurate blit to the backbuffer and an accurate blit from the backbuffer to the front buffer, then the next time through the loop it freezes. I have checked my clipping rects and they are fine, otherwise it would freeze on the first pass. I was wondering has this happened to anybody else before.
Image is 800X600 16bpp (custom format)
Fullscreen is set to 800X600 16bpp
BackBuffer in windowed mode is set to 800X600
fullscreen mode:
- Initialize Direct Draw object
- Set cooperative level to exclusive
- Create Primary Surface with complex/flip/primary/videomemory flags
- Attach Back Buffer with backbuffer count of 1
- Blit image to backbuffer
- Use the primary->flip() to display image
Windowed Mode:
- Initialize Direct Draw object
- Set cooperative mode to normal
- Create Primary Surface with primary/videomemory flags no size caps
- Create Back Buffer with offscreen/videomemory flags plus size caps
- Create clipper
- Set clipper window handle
- Use primary->SetClipper(clipper)
- Get Screen coords of client window
- Blit Image to back buffer
- Blit back buffer to primary using client coords
if I leave out steps 9 and 10, there is no freezing. If I Leave out step 9, it freezes after the first loop (and of course nothing is displayed). If I do everything in the list, It displays in the window perfectly the first time through the loop then freezes.
I was just curious if this has happend to anybody else so they could tell me what they discovered. I must have one tiny mistake somewhere that I am not catching, which makes me want to rip my hair out because I don''t want to rewrite the whole thing to figure out what I did wrong!