Archived

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

EmotionalRockAndRoll

Positively Dumb DirectDraw Issue...

Recommended Posts

OOH, my first post ever. T''is so exciting... Alright, I''m relatively new to DirectX, so take it easy on me: I''ve got everything set up, as far as I know, but all that seems to be displayed on the screen is 4 vertical bands of white and black, with lots of randomly placed (and colored) pixels atop the bands. This problem disappears when I remove the "while(lpddsPrimary->Flip(NULL,DDFLIP_WAIT)) line. Any suggestions pertaining to what could potentially be wrong would be appreciated, thanks. chances last a finite time.in the warm july nighttime.every care that keeps you from the beat.is a care that carries on defeat - Ozma-Domino Effect

Share this post


Link to post
Share on other sites
Absolutely nothing is wrong, as far as I can tell. DirectDraw doesn''t clear the surfaces, so you''re probably just blitting some random bits of memory to the screen, heh.. try drawing something on the surfaces or clearing them or something, it might make your problem go away.

Of course, if you''re already doing that then there *is* a problem, heh...

Share this post


Link to post
Share on other sites
Been a while since I used ddraw... I think the code to clear the backbuffer goes like this:

DDBLTFX fx = {sizeof(fx)};
fx.dwFillColor = 0; // or any other color
back_buffer->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &fx);

Share this post


Link to post
Share on other sites
I had the exact same problem not too long ago.... After reviewing my code, and advice from people here, I looked at my code, changed some stuff around, and it worked. Try adding a clipper, pallette, and check what you''re blitting and where you''re blitting it to. If it''s a square (which I just finished a movable square program :D) check the RECT structure and be sure that the second point''s coordinates are down and right of the first point''s.

Share this post


Link to post
Share on other sites
quote:
Original post by Beer Hunter
DDBLTFX fx = {sizeof(fx)};
fx.dwFillColor = 0; // or any other color
back_buffer->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &fx);



Always remember to fill your DDraw structs with 0s before using them. The tricky point is that if you don''t do this, it may work on some computers (or sometimes) but not always, and this can be a pain to debug.

DDBLTFX fx;
ZeroMemory( &fx, sizeof(fx));
fx.dwSize = sizeof(fx);
fx.dwFillColor = 0; // yeah, this is kinda useless now...
back_buffer->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &fx);



Share this post


Link to post
Share on other sites
About that line you removed:
while(lpddsPrimary->Flip(NULL,DDFLIP_WAIT))

Shouldn''t it be
while(FAILED(lpddsPrimary->Flip(NULL,DDFLIP_WAIT)))
Maybe you simply posted it in this form,
Just checking...

Share this post


Link to post
Share on other sites
Thanks guys and gals! All is well now ^_^

Origil: Yeah, I just left that out when I when posted the code here, because it''s part of a longer Error-Handling algorithm.


chances last a finite time.in the warm july nighttime.every care that keeps you from the beat.is a care that carries on defeat - Ozma-Domino Effect

Share this post


Link to post
Share on other sites
quote:
Original post by Beer Hunter
Which is exactly what I did by using a partial initializer list



What ? You mean a partial initializer set all the other stuff to 0 ? Damnit! I didn''t know this!

(giving a baseball bat to Beer Hunter)
Yeah, you can beat me to death...

Share this post


Link to post
Share on other sites