Advertisement

GDI Blitting

Started by February 20, 2002 03:56 PM
6 comments, last by breakscience 22 years, 10 months ago
Any time I have a background blitting in WM_PAINT, and blit a sprite inside my game loop, I get a lot of flicker. How can I get rid of this. I know that DirectX uses a "backbuffer" to avoid this, but what can I use with the standard GDI. If there is something I can do, let me know. Thanks. Break
Break;
I''m afraid that there really isn''t all that much you can do with the GDI in terms of game programming. It was designed to work well with business applications and such, but Microsoft even says that when it comes to multimedia or game software, it is just too slow. GDI only gives you access to a video buffer in system memory, not video memory, which means it won''t be very fast.


Robby
"Too late?!" There's no such thing as "too late!" That's why they invented death! - Walter Matthau in "Out To Sea"
Advertisement
Considering the amount of power in current generation PCs, GDI provides plenty of juice for small games - 2D, side scrollers, etc. You don''t need DirectX or OpenGL for Tetris. Check out Joseph Farrell''s series on game programming
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Try overriding WM_ERASEBKGND and type return 1 instead of the default implementation..

this should do it

cheers

-----------
my quote is under construction
-----------my quote is under construction
LessBread - That''s pretty scary...I am doing a Tetris clone! So I guess it''s ok to use the GDI. I found that it mainly flickers when I use the ROPs. When I do a straight "SRCCOPY" it''s solid. I dont really need transparency for tetris anyways.

mentat - Im going to try that, but I already have windowclass.hbrBackground set to NULL. Isn''t that the same thing...maybe not.

Thanx,
Break;
Break;
quote: Original post by breakscience
LessBread - That''s pretty scary...I am doing a Tetris clone!

LOL!

quote: Original post by breakscience
So I guess it''s ok to use the GDI. I found that it mainly flickers when I use the ROPs. When I do a straight "SRCCOPY" it''s solid. I dont really need transparency for tetris anyways.


I should qualify my statement regarding GDI and games. For a windowed game without dozens of sprites, GDI will suffice. For a fullscreen game with lots of sprites use DX or OGL.

Here are a couple links you might find useful:

Flicker-free drawing

2DGame
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Advertisement
The reason I want to use the GDI for this one, is so it will work on most PCs without DX. Thats why Im going to use the GDI for my Unreal clone too...no just kidding.

Break;
Break;
by the way, i have given an answer on using backbuffer and win32 on this forum, thread is "Bitmaps and back_buffers", that might help as well to get rid of flickering..

cheers

-----------
my quote is under construction
-----------my quote is under construction

This topic is closed to new replies.

Advertisement