Positively Dumb DirectDraw Issue...

Started by
7 comments, last by EmotionalRockAndRoll 21 years, 10 months ago
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
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
Advertisement
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...
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);
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.
HibikiWheres the any key?www.geocities.com/dragongames123/home.html
find your elementat mutedfaith.com.<º>
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);



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...
The Department of Next Life - Get your Next-Life Insurance here!
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
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
quote:Original post by Prosper/LOADED
Always remember to fill your DDraw structs with 0s before using them.

Which is exactly what I did by using a partial initializer list
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...

This topic is closed to new replies.

Advertisement