Windows GDI question???

Started by
18 comments, last by JIMbond21 20 years, 7 months ago
How do I eleminate the tearing effect when graphics are drawn using windows GDI? I use double buffering and my timer which makes the game run at 60 fps, and every 4 - 5 seconds it does the tearing effect. Plz Help!!!
THX,JAP
Advertisement
How are you doing the double buffering? You''re just using GDI for all the rendering? Are you rendering to a window or full-screen?
I use a bitmap in memory for the double buffer, then after drawing everything I blit that to the device context for the window, which I sort of make full screen by creating a maximized popup window, that appears as fullscreen. I only use GDI for rendering.
THX,JAP
The tearing could be a vertical retrace issue. Take a look at this article, perhaps it''s relevant: Detecting Vertical Retrace in Microsoft Windows.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Is there any easy way to detect vertical retrace when using windows GDI?
THX,JAP
Yes, use DirectDraw
Any other way without any directx?
THX,JAP
No, there is no easy way. Detecting the retrace is low level stuff that Windows was designed to stop programs from performing. DirectX is the answer (until Longhorn arrives).

Jason Doucette | Matthew Doucette
Programming Windows, 5th Edition by Charles Petzold, Errata Addendum
projects / games | real-time graphics | artificial intelligence | world records | wallpapers / desktops / backgrounds
"Great minds discuss ideas, average minds discuss events, small minds discuss people." - Anna Eleanor Roosevelt, 1884-1962
Jason Doucette / Xona.comDuality: ZF — Xbox 360 classic arcade shmup featuring Dual Play
<< Any other way without any directx? >>

I use GDI only for my full screen Asteroids game and had no tearing at all. Haven''t worked with Windows Bitmaps yet but I expect no tearing. Put a link to your source...

Are you sure you are doing this each frame: (1) erase back buffer, (2) draw all graphics to back buffer, then when all drawing done (3) BitBlt entire back to front at once. If so, you shouldn''t see any tearing...

VazGames.com

Phil P
Get rid of the erasebackground...

This topic is closed to new replies.

Advertisement