The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: redskull on September 16, 2010, 01:37:39 AM

Title: Console Flickering
Post by: redskull on September 16, 2010, 01:37:39 AM
Does anyone have a slick way of removing the flicker in the Win32 console when doing rapid updates?  I know it's just the console, and not performance oriented, but it's still a nagging problem.  I've tried writing directly to it, double buffering using both SetConsoleActiveScreenBuffer and copying directly using WriteConsoleOutputCharacter, both to no avail.  It used to not be so bad when I could go fullscreen in XP, but Viva Vista.  I know it's probably a lost cause, with the console being all wrapped up in CSRSS and all, but figured it would be worth a shot to ask.

-r
Title: Re: Console Flickering
Post by: frktons on September 16, 2010, 10:27:23 AM
Quote from: redskull on September 16, 2010, 01:37:39 AM
Does anyone have a slick way of removing the flicker in the Win32 console when doing rapid updates?  I know it's just the console, and not performance oriented, but it's still a nagging problem.  I've tried writing directly to it, double buffering using both SetConsoleActiveScreenBuffer and copying directly using WriteConsoleOutputCharacter, both to no avail.  It used to not be so bad when I could go fullscreen in XP, but Viva Vista.  I know it's probably a lost cause, with the console being all wrapped up in CSRSS and all, but figured it would be worth a shot to ask.

-r

Did you also try to set the cursor off?

Frank
Title: Re: Console Flickering
Post by: redskull on September 16, 2010, 12:23:39 PM
Quote from: frktons on September 16, 2010, 10:27:23 AM
Did you also try to set the cursor off?

Yes, to no avail; I even implemented a system to rewrite only the 'dirty' parts of the screen, and that only reduces the flicker to those sections being rewritten.  I guess that's just life.  :'(

-r
Title: Re: Console Flickering
Post by: daydreamer on September 16, 2010, 01:12:03 PM
what about rewrite it to be a windows app with directx you have full control of things so you can time it so backbuffer writes at waitforvertical sync or maybe even call direct3d api that writes text on screen?

Title: Re: Console Flickering
Post by: Tedd on September 16, 2010, 04:05:42 PM
It will be down to blanking and then redrawing without waiting for vsync, as always. Presumably they don't expect you to want to update your text so frequently, and when you do it's going to be through printing a multitude of lines, so it's not really important.
All I can suggest is updating only what you need to (done) and reduce the frequency of your updates where possible (do you really need to update more than 10 times a second?)
Title: Re: Console Flickering
Post by: redskull on September 16, 2010, 05:01:21 PM
It doesn't even really seem dependent on speed though; More often, just single blank and redraw will produce a flicker; that is, 'erasing' the particular area by repainting the old (saved) background via WriteConsoleOutput, and then redrawing it at the new position (with another WriteConsoleOutput from a different buffer).  It's not even like I'm aiming for 30fps of animation, just repositioning a block of characters once.  I guess the best way is to find a dark color scheme that hides it well.

thanks

-r
Title: Re: Console Flickering
Post by: Twister on September 16, 2010, 09:07:48 PM
Turn the cursor off and only write on parts of the console you need to write on.

Or you could just edit the video memory of the console directly.
Title: Re: Console Flickering
Post by: GregL on September 16, 2010, 09:29:35 PM
redskull,

You said you tried double buffering.  I have had success with double buffering and writing the entire screen when any part needed updating.



Title: Re: Console Flickering
Post by: redskull on September 17, 2010, 12:41:17 AM
Quote from: GTX on September 16, 2010, 09:07:48 PM
Or you could just edit the video memory of the console directly.

How does one go about doing this?