Thread: Visual Artifacts, [GDI]

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    Visual Artifacts, [GDI]

    Hi, when blitting things to the screen in rapid succession you get visual artifacts (i.e. tearing). In DirectX I would just use a back buffer and flip during vertical blank intervals to remedy this. Well using only GDI here is what I'm thinking. Can I just create 2 DC's and use one as a 'back buffer' type deal and blit from that one to the main one when I want to draw my current frame? Anyone deal with this, or have a better way?

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    73
    If you know how to handle it in direct x, why not simpily use direct x? The win api wasn't meant for high end graphical applications. That is why Direct X was concieved....

  3. #3
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Originally posted by Zoalord
    That is why Direct X was concieved....
    True, but DirectX windowed (ie: not fullscreen) can be a pain sometimes.

    I normally do one of two things:

    1) Use FillRect to blt a solid color (usually black) onto the DC before you blt your sprites.

    2) Use another sprite that covers your entire background area and blt it before you blt your other sprites.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>Can I just create 2 DC's and use one as a 'back buffer' type deal and blit from that one to the main one when I want to draw my current frame?

    Yes. Thats what I do.

    Works a treat, remember to FillRect() (or similar) with a solid background, inbetween drawings, in case to user changes the size of the window ect.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    The reason I can't use DirectX is because the program is for a graphics class. If I could use DirectX I would not need to scan convert polygons. Granted I can scan convert them in GDI but one of the requirements is no use of external library except GDI. Thanks for the help I will try the 2 DC's approach.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM