Thread: Help removing slight switch flicker

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001

    Help removing slight switch flicker

    I have this windowed DirectX program with a tab-control being a child to the "main" window. Each "page" has a child window where the rendering takes place (using swap chains). When the tab changes I hide the currently visible child window then show the newly selected child window.

    Now, generally everything works fairly ok except when selecting a new tab there is sometimes a slight flicker appearing the instant it changes.

    I guess this is caused by some of the controls being rendered (tabview or child window, the main window has no background brush), but validating their areas (ValidateRect) after showing/hiding still causes flickers. Any ideas what might cause it and how to prevent it?

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Well if it's MFC I had the same problem with one renderer. I'm not drawing to the DC of the window because the renderer is using it's own window inside of a window.

    My solution was to trap EvEraseBkgnd and always return TRUE. The double buffer for DirectX took care of the rest and the flicker is gone.

    Dunno if it will help for you. I believe the message to trap for is WM_ERASEBKGND. Not sure but you can look it up in the Platform SDK.

    EDIT: Now that I've seen some of your previous posts I'm also thinking you are using threads. You will get flicker when one thread attempts to access a resource that another thread is already using. You can prevent this by using WaitForSingleObject() and the other thread functions available in the API. I had the same problem when my renderer would render tiles at the same time the tile picker window would render the same tiles. As they both rendered the same tiles, the set in the tile picker window would flicker. Annoying as heck.
    Last edited by VirtualAce; 05-12-2006 at 04:23 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. ascii rpg help
    By aaron11193 in forum C Programming
    Replies: 18
    Last Post: 10-29-2006, 01:45 AM
  3. Switch
    By cogeek in forum C Programming
    Replies: 4
    Last Post: 12-23-2004, 06:40 PM
  4. Switch Case
    By FromHolland in forum C++ Programming
    Replies: 7
    Last Post: 06-13-2003, 03:51 AM