may we see your rendering code and d3d init code?
here it is:
Code:
{$REGION 'Direct3D procedures'}
procedure twinform.initd3d();
var presentParams:presentparameters;
begin
presentParams := PresentParameters.Create;
presentParams.Windowed:=true;
presentParams.SwapEffect:=SwapEffect.Discard;
presentparams.BackBufferCount:=1;
presentparams.BackBufferWidth:=self.ClientSize.width;
presentparams.BackBufferHeight:=self.ClientSize.height;
device1 := Device.Create(0, DeviceType.Hardware, self, CreateFlags.HardwareVertexProcessing, [presentParams]);
end;
procedure twinform.render1();
begin
device1.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1, 0);
device1.BeginScene();
device1.EndScene();
device1.Present();
end;
{$ENDREGION}
30 == 60 / 2
So if your app requires more than 17ms to render single frame - you'll be getting 30 FPS. This is common issue with games for example.
That is true (I hate VSYNC for that), but I have a very fast machine and the application is very simple. And also when I comment the line "device1.present();" out, FPS increases substentially.
Actually, I've just ran the this thing again with "device1.present();" commented out. FPS jumps wierdly between 17 and 80000. When I comment "device1.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1, 0);" line FPS stays stady around 500000. Here is the piece of code where I count FPS
Code:
var thistick,lasttick,frames:integer;
fps:single;
//counting FPS
inc(frames);
thistick:=environment.get_TickCount;
if thistick-lasttick>100 then begin
fps:=frames*1000/(thistick-lasttick);
label1.Text:=system.String.Format('FPS: {0}',[fps.tostring('00000000.00')]);
frames:=0;
lasttick:=environment.get_TickCount;
end;
Thanks
Bookmarks