私はOpenGL、Qt、C++を使って3Dモデル表示プログラムを書いています.しかし、私は何か奇妙なことを発見しました.それは、リリースモードバージョンのFPS(フレーム/秒)がデバッグモードバージョンよりも低いです.今、私は彼らのFPSを投稿します:
左がデバッグモード版、右がリリースモード版です。
FPS の計算に使用する関数は次のとおりです。
void displayFPS()
{
static float framesPerSecond = 0.0f; // This will store our fps
static float lastTime = 0.0f; // This will hold the time from the last frame
float currentTime = GetTickCount() * 0.001f;
++framesPerSecond;
if( currentTime - lastTime > 1.0f )
{
framesPerSecond/=currentTime - lastTime;
char strFrameRate[256];
lastTime = currentTime;
sprintf_s(strFrameRate,256, "FPS : %f", framesPerSecond);
cout << strFrameRate << endl;
framesPerSecond = 0;
}
}
なぜこれが起こるのだろうか?リリースモードはデバッグモードよりも速くすべきではないのだろうか?誰かが理由を教えてくれるだろうか?