DirectDraw fade 2

This is a discussion on DirectDraw fade 2 within the Game Programming forums, part of the General Programming Boards category; Hey guys/gals! I updated the code that performs my gamma ramp fades in DirectDraw. The problems I had were that ...

  1. #1
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065

    DirectDraw fade 2

    Hey guys/gals! I updated the code that performs my gamma ramp
    fades in DirectDraw. The problems I had were that I was using an
    incrementing long value as a timer, ie:
    Code:
    long TimeTracker;
    TimeTracker++;
    if(TimeTracker==300)
    {
       do stuff
       TimeTracker=0;
    }
    This obviously wasn't effecient and especially wasn't practical, as
    it would run super fast on new machines and slow as molassess
    on older ones.

    The other problem was that I was setting the gamma ramp values
    to 0 then incrementing +/- 1000 per iteration. This was bad
    because if you have really low gamma settings then your screen
    wouldn't fully reset to it's proper gamma settings and all you'd
    see was a black screen (like TechWins).

    The fix for this was a little trickier. I declared 3 global arrays of
    DWORDs to hold my gamma increment value. Then every 100
    milliseconds I add that value to the gamma settings. Since I set
    the value to setting/8, I incremented by the DWORD value for the
    first 8 iterations of the function call. On the ninth I finished the
    gamma ramp transition (settings=0 or setting=original, depending
    on which way I was traversing the ramp).

    Code:
    DWORD dwRd[256], dwGr[256], dwBl[256];
    for(i=0;i<256;i++)
    {
      if(lpddGR.red[i]>8)
      {
        dwRd[i]=lpddGR.red[i]/8;
      }
      lpddGR.red[i]=0;
      //etc. etc. for green and blue arrays
    }
    I'm attaching a new *.zip file. Please test it and let me know what
    results you get and what you think of the fade. Thanks.

    Oh, and anyone who wants more details on the gamma ramp
    fading technique can just PM me or ask here and I'll go into more
    detail. Also, you'll need DirectX 7 or higher to run it.

    Thanks again.
    Attached Files Attached Files

  2. #2
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    yeah, its better than the first one.

    though if the UNTER GRUND(sp) fade in/out was a little slower it would look neater.

  3. #3
    Unregistered
    Guest
    Yay, it works now!!! Maybe a bit fast, but that's just my opinion,

  4. #4
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    I guess it's a case of overkill. Everyone said it was too slow in the
    first attempt so I went the other extreme. I'm just going to find
    the happy medium.

    And you did spell "UnterGrund" right. It's German for
    underground ( which is where I lived when I first started
    programming ).
    Last edited by jdinger; 04-26-2002 at 01:44 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fade in out of Wav file
    By jase_dukerider in forum C Programming
    Replies: 0
    Last Post: 04-14-2005, 05:06 AM
  2. Replies: 3
    Last Post: 08-14-2003, 01:37 PM
  3. Windowed DirectDraw problems
    By Magos in forum Windows Programming
    Replies: 0
    Last Post: 01-20-2003, 12:00 PM
  4. Looking for help on DirectDraw operations
    By Magos in forum Windows Programming
    Replies: 5
    Last Post: 01-19-2003, 11:36 AM
  5. DirectDraw Tutorials
    By Robert602 in forum Game Programming
    Replies: 3
    Last Post: 12-14-2001, 09:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21