Archived

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

breakscience

GDI Blitting

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Try overriding WM_ERASEBKGND and type return 1 instead of the default implementation..

this should do it

cheers

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

Share this post


Link to post
Share on other sites
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;

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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;

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites