Advertisement

Flickering GDI Graphics

Started by January 12, 2000 09:59 PM
3 comments, last by rtr1129 24 years, 11 months ago
I''m a long time DOS programmer turned Windows and I''m learning GDI. I''m getting a lot of flicker in my graphics. In DOS this problem was solved by using a double buffer or hooking up with the vertical retrace. So how do you get rid of the flicker in Windows?
I assume when you reference GDI, you mean in the stock GDI functions of the Win32 API. Though this isn''t the be all end all explination of things, in general the GDI functions as rich as they are so to speak, are mainly for business type applications, etc.

In order to do any kind of high performance multimedia type applications, you should look into DirectX or any other high performance API, LIB what have you.

There are various resources right here on gamedev alone on this subject and the best way to start is just researching till you find something that sounds like what you need or gets the job done. Again, you can do it from scratch or browse around and find various libraries etc.

If you must use the standard Win32 GDI for whatever reason, there are various techniques you can attempt to perform; for example:

proper rect validation, correct resource management, multiple threads, more system ram, etc.

However, latching on to the vertical sync isn''t one of them.

~deadlinegrunt

Advertisement
I plan on using DirectX when I get into making real games. But at the moment I''m just making simple games like Pong just to get some windows programming under my belt. And I just think that using DirectX to make Pong is a little overboard.

My main goal right now is to make a simple game that looks decent, runs well, and will run fine without the need of installing DirectX on the system.

So my new question will be:
WHAT IS THE BEST WAY TO DO NON DIRECTX GRAPHICS IN WINDOWS?

If you are trying to develop a game or something, you should use DirectX. In fact, DirectX was created originally just so you could perform DOS quality drawing in Windows.

But to get back to your question, one very effective technique in Windows is to use all of you GDI calls on a memory DC. Then you can blit that DC over to the screen DC. Also, you should make sure that you are only drawing what you need to draw using update regions since Windoes GDI is SLOW!!!
The first thing you need to do in order to get rid of most of the flickering is respond to the WM_ERASEBKGND message and return a boolean true.
Chris

This topic is closed to new replies.

Advertisement