Thread: Clearscreen--I dont get it...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    195

    Clearscreen--I dont get it...

    In console programs, do you ever notice that the screen flickers when you refresh the screen too much? For example, when i am making tetris, as the block falls down further and further, the console flashes every time it redraws the screen.

    But then im wondering, how can First Person Shooters run at 80+ frames/second and not flash at all. Is the console clearscreen method flawed? I mean, in games like Counterstrike, it renders the screen much more often than in my console tetris yet it never flickers.

    Someone tell me what is with this please.

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Almost all games use double (or triple) buffering. If you don't know what that is, Google for it.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    ‡ †hë Ö†hÈr sîÐè ‡ Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    to be more specificamigated.
    in 3d games you have a 3d acclartor. graphics card

    when using directx d3d openGL etc. your program basicly talks to the card.

    when using a console your program talks to the OS.
    then waits for the os to take control.
    then when the os finishes its "who the hell knows what" it flushes your input.
    then retruns control back to your program. to sum it up

    flashing occurs when you let the user see you drawing to the screen.

    buffer flipping "double (or triple) buffering" is when you display the first buffer to the screen and you draw on the second. when your finished drawing you then flip/switch the buffers(or pointers to the buffers) so that the frame you just drew is now the one being displayed.

    [edit]
    a good idea is to make a char* buffer draw/write/dance to it then flush when your done.
    Last edited by Nor; 12-30-2003 at 04:38 PM.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. clearscreen using borland libraries
    By ryan_germain in forum C++ Programming
    Replies: 2
    Last Post: 08-04-2004, 09:50 AM
  2. clearscreen
    By Jotun in forum C++ Programming
    Replies: 3
    Last Post: 04-18-2004, 03:55 PM
  3. ClearScreen
    By KneeGrow in forum C++ Programming
    Replies: 5
    Last Post: 05-25-2003, 07:26 PM
  4. Windows console... clearscreen?
    By gMan in forum Windows Programming
    Replies: 8
    Last Post: 04-11-2003, 01:18 AM
  5. ClearScreen so bad you cant see anything
    By bluehead in forum C++ Programming
    Replies: 9
    Last Post: 02-26-2002, 01:37 PM