Changeset 451


Ignore:
Timestamp:
Nov 23, 2012, 2:09:49 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Real FPS is now measured as cumulative.
Location:
GraphicTest
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Methods/UOpenGLMethod.pas

    r447 r451  
    99  {$IFDEF opengl}, GL, GLExt, OpenGLContext{$ENDIF};
    1010
     11{$IFDEF opengl}
    1112type
    12   {$IFDEF opengl}
    1313  { TOpenGLMethod }
    1414
     
    2323implementation
    2424
     25{$IFDEF opengl}
    2526{ TOpenGLMethod }
    2627
     
    9697end;
    9798
     99{$ENDIF}
    98100
    99101end.
  • GraphicTest/Methods/UOpenGLPBOMethod.pas

    r447 r451  
    99  {$IFDEF opengl}, GL, GLExt, OpenGLContext{$ENDIF};
    1010
     11{$IFDEF opengl}
    1112type
    12   {$IFDEF opengl}
    1313  { TOpenGLPBOMethod }
    1414
  • GraphicTest/UDrawMethod.pas

    r449 r451  
    3030    FrameCounter: Integer;
    3131    FrameCounterStart: TDateTime;
     32    FrameCounterStop: TDateTime;
    3233    function GetFPS: Real;
    3334    property FPS: Real read FFPS write FFPS;
     
    180181
    181182function TDrawMethod.GetFPS: Real;
    182 begin
    183   Result := FrameCounter / ((NowPrecise - FrameCounterStart) / OneSecond);
    184   FrameCounter := 0;
    185   FrameCounterStart := NowPrecise;
     183var
     184  StopTime: TDateTime;
     185begin
     186  if FrameCounterStop <> 0 then StopTime := FrameCounterStop
     187    else StopTime := NowPrecise;
     188  if FrameCounter > 0 then begin
     189    Result := FrameCounter / ((StopTime - FrameCounterStart) / OneSecond);
     190    //FrameCounter := 0;
     191    //FrameCounterStart := NowPrecise;
     192  end else Result := FFPS;
    186193end;
    187194
  • GraphicTest/UMainForm.lfm

    r450 r451  
    1313  LCLVersion = '1.1'
    1414  object PageControl1: TPageControl
    15     Left = 555
     15    Left = 459
    1616    Height = 411
    1717    Top = 0
    18     Width = 302
     18    Width = 398
    1919    ActivePage = TabSheet1
    2020    Align = alRight
     
    2424      Caption = 'Description'
    2525      ClientHeight = 385
    26       ClientWidth = 294
     26      ClientWidth = 390
    2727      object Memo1: TMemo
    2828        Left = 0
    2929        Height = 385
    3030        Top = 0
    31         Width = 294
     31        Width = 390
    3232        Align = alClient
    3333        ReadOnly = True
     
    526526    Height = 411
    527527    Top = 0
    528     Width = 550
     528    Width = 454
    529529    Align = alClient
    530530    BevelOuter = bvNone
    531531    ClientHeight = 411
    532     ClientWidth = 550
     532    ClientWidth = 454
    533533    TabOrder = 1
    534534    object ListViewMethods: TListView
     
    536536      Height = 335
    537537      Top = 8
    538       Width = 539
     538      Width = 443
    539539      Anchors = [akTop, akLeft, akRight, akBottom]
    540540      Columns = <     
     
    545545        item
    546546          Caption = 'FPS'
     547          Width = 75
    547548        end     
    548549        item
    549           Caption = 'Duration custom draw [ms]'
     550          Caption = 'Duration [ms]'
    550551          Width = 80
    551552        end     
     
    555556        end     
    556557        item
    557           Caption = 'Duration step [ms]'
     558          Caption = 'Draw duration [ms]'
    558559          Width = 80
    559560        end     
     
    561562          Caption = 'Step FPS'
    562563          Width = 75
     564        end     
     565        item
     566          Caption = 'Step duration [ms]'
     567          Width = 80
    563568        end>
    564569      OwnerData = True
     
    631636    end
    632637    object SpinEditWidth: TSpinEdit
    633       Left = 219
     638      Left = 204
    634639      Height = 21
    635640      Top = 382
     
    642647    end
    643648    object SpinEditHeight: TSpinEdit
    644       Left = 288
     649      Left = 273
    645650      Height = 21
    646651      Top = 382
     
    653658    end
    654659    object Label3: TLabel
    655       Left = 184
     660      Left = 169
    656661      Height = 13
    657662      Top = 387
     
    662667    end
    663668    object Label4: TLabel
    664       Left = 280
     669      Left = 265
    665670      Height = 13
    666671      Top = 386
     
    671676    end
    672677    object CheckBoxDoubleBuffered: TCheckBox
    673       Left = 408
     678      Left = 336
    674679      Height = 17
    675680      Top = 350
     
    681686    end
    682687    object CheckBoxEraseBackground: TCheckBox
    683       Left = 408
     688      Left = 336
    684689      Height = 17
    685690      Top = 367
     
    691696    end
    692697    object CheckBox1: TCheckBox
    693       Left = 408
     698      Left = 336
    694699      Height = 17
    695700      Top = 387
     
    702707  end
    703708  object Splitter1: TSplitter
    704     Left = 550
     709    Left = 454
    705710    Height = 411
    706711    Top = 0
  • GraphicTest/UMainForm.pas

    r450 r451  
    130130    StartTime := NowPrecise;
    131131    FrameCounterStart := NowPrecise;
     132    FrameCounterStop := 0;
    132133    FrameCounter := 0;
    133134    repeat
     
    140141    until TestTerminated or
    141142      ((TestTimeout > 0) and ((NowPrecise - StartTime) > OneSecond * TestTimeout));
    142     FPS := GetFPS;
     143    FrameCounterStop := NowPrecise;
     144    //FPS := GetFPS;
    143145    Done;
    144146  end;
     
    157159      TestMethod(TDrawMethod(DrawMethods[MethodIndex]));
    158160  finally
    159     TimerUpdateList.Enabled := False;
     161    //TimerUpdateList.Enabled := False;
    160162    SingleTestActive := False;
    161163    UpdateInterface;
     
    234236  with TDrawMethod(DrawMethods[Item.Index]) do begin
    235237    Item.Caption := Caption;
     238    FPS := GetFPS;
    236239    Item.SubItems.Add(FloatToStr(RoundTo(FPS, -3)));
    237     Item.SubItems.Add(FloatToStr(RoundTo(FrameDuration / OneMillisecond, -3)));
     240    if FPS > 0 then
     241      Item.SubItems.Add(FloatToStr(RoundTo(1 / FPS * 1000, -3)))
     242      else Item.SubItems.Add('0');
    238243    if FrameDuration > 0 then
    239244      Item.SubItems.Add(FloatToStr(RoundTo(1 / (FrameDuration / OneSecond), -3)))
    240245      else Item.SubItems.Add('0');
    241     Item.SubItems.Add(FloatToStr(RoundTo(StepDuration / OneMillisecond, -3)));
     246    Item.SubItems.Add(FloatToStr(RoundTo(FrameDuration / OneMillisecond, -3)));
    242247    if FrameDuration > 0 then
    243248      Item.SubItems.Add(FloatToStr(RoundTo(1 / (StepDuration / OneSecond), -3)))
    244249      else Item.SubItems.Add('0');
     250    Item.SubItems.Add(FloatToStr(RoundTo(StepDuration / OneMillisecond, -3)));
    245251  end;
    246252end;
Note: See TracChangeset for help on using the changeset viewer.