Archived

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

Laroche

DirectDraw...again...

Recommended Posts

every time i try and render the scene using blt or flip (im not sure which one is causing the error) the window just closes..i put in error checking and everything is OK it seems...if anyone could check out the code of my message pump i would appreciate it, i think its exiting prematurely for some reason. Its just got a simple blt and flip for 1 bitmap file contained in a class while (TRUE) { if (PeekMessage( &Msg, NULL, 0, 0, PM_NOREMOVE )) { TranslateMessage(&Msg); DispatchMessage(&Msg); } if (KEYSTATE(VK_ESCAPE)) { break; } if (FAILED (pDirectDraw->CDDW_GetlpDDSBack()->BltFast( 0, 0, pCool->GetSurface(), &rcFrom, DDBLTFAST_WAIT ))) { MessageBox(NULL, "uh oh", "DAMN", MB_YESNO); } pDirectDraw->CDDW_GetlpDDSPrimary()->Flip(NULL, DDFLIP_WAIT); } I''d appreciate any help as this problem is ANNOYING...when i don''t do any blts or flips everything works fine.

Share this post


Link to post
Share on other sites
Well Laroche,
the error may not always be were u expect them to be, as we don''t know the interrelation between ur objects(classes), uhmmm...ur code seems clear,try to check elsewhere
it may be a NULL->DoSomething() problem, or something else,..

Share this post


Link to post
Share on other sites
window exiting while running dx without a gpf ssually means you trashed something within dx. ie you wrote past an array. check all your arrays for any sort of out of bounds conditions.

Share this post


Link to post
Share on other sites
hmm...I don''t even use arrays in this test

I took out the Blt code, and left the flip, and it worked fine ie: it didn''t quit as soon as it opened. I tried taking out the flip and leaving the blt, and it closes right away, so I''m sure it has to do with the blt call. I talked with one of my friends today who is learning how to blt and he gets the very same error, says he''s been working at it for weeks...I KNOW it''s something rather silly, but I really can''t figure out what it is...I rechecked the initialization code against several tutorials and everything looks fine. Im sure someone has had experience with this problem who would be able to point it out to me, until then...well, not sure what else to do.

Share this post


Link to post
Share on other sites
If you have DX8.1, go to Control Panel, DirectX, Direct3D and check ''Use debug runtime'' as well as slide ''debug level'' to the max. Do this whenever you have trouble with DX; it helps.

Share this post


Link to post
Share on other sites
I tried that suggestion with directx run-time; evrything seems ok. I did tests in direct 3d, directdraw, and directxgraphics(direct 3d test did it, actually). Everything is fine, 100%. I put the debug level to max and re-compiled; same problem. I have no idea what is wrong..Could it be the code which is causing this? I get no errors or warnings, but it''s not the only indicator, I know

Share this post


Link to post
Share on other sites
if you blit surfaces of different formats and different sizes you could use rects that are not correctly sized. directdraw does not check too much for errors during blits. you could be blitting off the surface and that would crash (againdx dont check for speed). set up a clipper might help. ANY access to a surface is like access an array. you CAN go out of bounds and cause problems. also you should not blit from the same surface to itself, while it should not crash, it can cause problems (check the sdk for more info).

Share this post


Link to post
Share on other sites