🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Program crash when calling Flip() in DX7

Started by
3 comments, last by acw83 24 years, 6 months ago
My program crashes everytime I call flip or attempt to blt on the back surface. Here is my Init code, tell me what is wrong: DDSURFACEDESC2 ddsd; DDSCAPS2 ddscaps; DirectDrawCreateEx(NULL, (VOID**)&g_pDD, IID_IDirectDraw7, NULL); g_pDD->SetCooperativeLevel(hWnd, flags); g_pDD->SetDisplayMode(width, height, bpp, refresh, NULL); ZeroMemory(&ddsd, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS / DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE / DDSCAPS_FLIP / DDSCAPS_COMPLEX; ddsd.dwBackBufferCount = 1; g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL); ZeroMemory(&ddscaps, sizeof(ddscaps)); ddscaps.dwCaps = DDSCAPS_BACKBUFFER; g_pDDSPrimary->GetAttachedSurface(&ddscaps, &g_pDDSBack); I can set the display mode and blt to the front surface, but I seem to be messing up when I initialize the back surface somehow. Thanks.
Advertisement
You''re dividing all the bit flags, you want to OR them.

Try switching the /''s to /''s.
They are ORed, it''s jsut this HTML crap messing up my cut an paste...
Hi

well you dont check for the return values of the function. check eqach DDraw function return value.. if all return DD_OK then it is very odd that it crashes.. if not, you must check which function is not returning DD_OK and then check the return value and see what the error is !!

hope it helps

bruno sousa aka akura
It's good to be an outcast, you don't need to explain what you do, you just do it and say you don't belong there.
I agree with Akura. You should always check every functions return during the initialization. It isn''t time critical, so there is no excuse for such poor programming behavior.

This topic is closed to new replies.

Advertisement