Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Language: C++

Out-of-the-box, the HPS MFC Sandbox does not have a method to do a general FPS performance test. To address that, code is provided below in our forum post that can be inserted in one of the user code slots:

...

Open the Visual Studio solution “visualize_v140.sln” found in the directory:
HOOPS_Visualize_202X_SPX\samples

...

one of the user code slots

...

Code Block
languagecpp
void CHPSView::OnUserCode3()
{
	double t0, t1;
	int animation_steps = 30;
	int total_animation_steps = 0;
	int minimum_time = 3000;

	t0 = HPS::Database::GetTime();
	do
	{
		for (int i = 0; i < animation_steps; ++i)
		{
			_canvas.GetFrontView().GetSegmentKey().GetCameraControl().Orbit((float)(360 / animation_steps), 0);
			_canvas.UpdateWithNotifier().Wait();
		}
		total_animation_steps += animation_steps;
		t1 = HPS::Database::GetTime();
	} while (t1 - t0 < minimum_time);

	double time_passed = t1 - t0;
	double myFPS = total_animation_steps * 1000 / (t1 - t0);

	CString strMsg;
	strMsg.Format(_T("FPS: %f"), myFPS);
	AfxMessageBox(strMsg);
}

...

.

Attached is a screenshot of the result:

...