Skip to main content
GameDev.net gamedev.net
🔒 Locked

ahhh help(bpp size)

Started by Arkon Nov 11, 2000 at 4:34 PM 4 replies 450+ views
Original Post
Arkon
Arkon
ahh i''m confused!! please help me with my stupid problem let''s say my front screen buffer is 640x480x16b so it means that if i want to clean the screen i have to memset(buf, 0, 640x480x16/8); ?? i divide the bit by byte so i get the number of bytes per pixel so it should work isn''t it?? thanks! Arkon
Ironblayde
Ironblayde
Sure, you can do that. Or alternatively, use the blitter. The following code fills out a DDBLTFX structure and clears the DirectDraw surface given by lpdds.

  
DDBLTFX fx;
ZeroMemory(&fx, sizeof(fx));
fx.dwSize = sizeof(fx);
fx.dwFillColor = 0; // black

lpdds->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &fx);


-Ironblayde
 Aeon Software

Next thing you know, they''ll take my thoughts away.
"Your superior intellect is no match for our puny weapons!"
Arkon
Arkon
why not to use bltfast???
ColdFlame
ColdFlame
BltFast can''t do colour fills, and except in the HEL, it''s not *ANY* faster (I think)

Memset doesn''t work because the video memory can be wider than the back buffer, so you aren''t getting all of it. You could use the lPitch value, but then you''d trash god knows what in your video memory as well as your back buffer.

Hope this helps.



Oh well, Whatever, Nevermind
Oh well, Whatever, Nevermind
JonnyQuest
JonnyQuest
Yeah don''t use memset!

Apart from messing up the nonvisible part of the surface (which is already bad enough and is likely to crash your system) you also can''t specify a proper colour - all your bytes must be the same with memset so in 8888 mode you only get grey shades and in 16 bit mode you get various crazy colours...

- JQ, PWC Software
"programming is all about wasting time" -me
~phil
Arkon
Arkon
thanks for the tips!!!
you really helped me

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.