Changeset 212 for GraphicTest/UMainForm.pas
- Timestamp:
- Mar 20, 2011, 7:18:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/UMainForm.pas
r211 r212 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 9 ExtCtrls, StdCtrls, DateUtils, UPlatform, LCLType, IntfGraphics, fpImage, 10 Math, GraphType, Contnrs, LclIntf, UFastBitmap, UDrawMethod, GL, OpenGLContext; 10 Math, GraphType, Contnrs, LclIntf, Spin, UFastBitmap, UDrawMethod, GL, 11 OpenGLContext; 11 12 12 13 const … … 23 24 ButtonStop: TButton; 24 25 ComboBox1: TComboBox; 26 FloatSpinEdit1: TFloatSpinEdit; 25 27 Image1: TImage; 26 28 Label1: TLabel; … … 47 49 TextureId: GLuint; 48 50 TextureData: Pointer; 51 MethodIndex: Integer; 49 52 procedure OpenGLControl1Resize(Sender: TObject); 50 53 procedure InitGL; … … 104 107 NewDrawMethod.OpenGLBitmap := TextureData; 105 108 NewDrawMethod.OpenGLControl := OpenGLControl1; 109 NewDrawMethod.Init; 106 110 DrawMethods.Add(NewDrawMethod); 107 111 ComboBox1.Items.Add(NewDrawMethod.Caption); … … 112 116 procedure TMainForm.ButtonStartClick(Sender: TObject); 113 117 begin 118 MethodIndex := ComboBox1.ItemIndex; 114 119 ButtonStop.Enabled := True; 115 120 ButtonStart.Enabled := False; 116 121 Timer1.Enabled := True; 117 if ComboBox1.ItemIndex >= 0 then118 with TDrawMethod(DrawMethods[ ComboBox1.ItemIndex]) do begin122 if MethodIndex >= 0 then 123 with TDrawMethod(DrawMethods[MethodIndex]) do begin 119 124 PageControl1.TabIndex := Integer(PaintObject); 120 125 Application.ProcessMessages; … … 132 137 NewItem: TListItem; 133 138 I: Integer; 134 begin 139 C: Integer; 140 StartTime: TDateTime; 141 begin 142 Timer1.Enabled := True; 135 143 with ListView1, Items do 136 144 try 137 BeginUpdate;145 //BeginUpdate; 138 146 Clear; 139 147 for I := 0 to DrawMethods.Count - 1 do 140 148 with TDrawMethod(DrawMethods[I]) do begin 149 MethodIndex := I; 141 150 PageControl1.TabIndex := Integer(PaintObject); 142 Application.ProcessMessages; 143 DrawFrameTiming(TFastBitmap(Scenes[0])); 144 Application.ProcessMessages; 145 DrawFrameTiming(TFastBitmap(Scenes[0])); 151 StartTime := NowPrecise; 152 repeat 153 DrawFrameTiming(TFastBitmap(Scenes[SceneIndex])); 154 SceneIndex := (SceneIndex + 1) mod Scenes.Count; 155 Application.ProcessMessages; 156 until (NowPrecise - StartTime) > OneSecond * FloatSpinEdit1.Value; 146 157 NewItem := Add; 147 158 NewItem.Caption := Caption; … … 150 161 end; 151 162 finally 152 EndUpdate;163 //EndUpdate; 153 164 end; 154 165 end; … … 175 186 procedure TMainForm.Timer1Timer(Sender: TObject); 176 187 begin 177 if ( ComboBox1.ItemIndex >= 0) then178 with TDrawMethod(DrawMethods[ ComboBox1.ItemIndex]) do begin188 if (MethodIndex >= 0) then 189 with TDrawMethod(DrawMethods[MethodIndex]) do begin 179 190 if (FrameDuration > 0) then 180 191 Label2.Caption := FloatToStr(RoundTo(1 / (FrameDuration / OneSecond), -3)) … … 194 205 glLoadIdentity; 195 206 glOrtho(0, OpenGLControl1.Width, OpenGLControl1.Height, 0, 0, 1); 207 // glOrtho(0, 1, 1, 0, 0, 1); 196 208 glMatrixMode(GL_MODELVIEW); 197 209 glLoadIdentity();
Note:
See TracChangeset
for help on using the changeset viewer.