Jump to content
  • Advertisement
Sign in to follow this  
SAL1

Win32 API: Am I missing something?

This topic is 4607 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am currently writing an application that has my own customized GUI style (or at least I'm intending to), the thing is, GDI is very slow and drawing some effects using bitmap blits, text and straight GDI calls makes the application update slowly, it even has something that looks like tearing when repainting, you know like when you create a graphical application that uses a single buffer and try to draw things as fast as possible? I have seen many applications that completely customizes the look with alpha blending, animation and other effects but they still retain the highest performance possible, what are these applications using to achieve that under windows? what is the secret? Thanks in advance for any replies.

Share this post


Link to post
Share on other sites
Advertisement
They are most likely also using GDI. They are just using smart tricks like only re-painting when absolutely required. In a full-screen game we re-paint as fast as possible, under Win32 we should wait for the WM_PAINT message and only paint inside the "dirty region".

Share this post


Link to post
Share on other sites
when using GDI i almost always draw to a dibsection and blit the result to the client window rather than draw directly to the window. this way, when the window needs repainting but the drawing hasn't changed, you only have to reblit your dibsection rather than redraw everything. it's kind of like caching, sort to say, and it works fairly well.

Share this post


Link to post
Share on other sites
Bliting to a dib section is a very nice idea, but how slow is it for an application that constantly updates it's contents? is it fast enough?

Share this post


Link to post
Share on other sites
It's fast enough for simple 2D games and non-game applications, but it really depends on how many BitBlt, PatBlt, and other GDI calls you are making to it, and the amount of overdraw. you can reap 60-100 fps easily if you're careful. If the sheer amount of GDI calls is too much for your system however, you'd probably be better off switching to Direct3D (like if you have hundreds of moving lines, it's better to use Direct3D's line list or line strip rather than a ton of MoveToEx and LineTo calls).

Share this post


Link to post
Share on other sites
GDI is fast enough for basically everything except complex games and really high powered CAD stuff and the like. The most common reason an app will run slow is that, as has been mentioned, it has some naive repainting logic that makes no attempt to optimize what it is drawing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!