|
|
为什么我的程序只显示了一行文本,FPS也不超过60呢?
下面是显示部分的代码。
void RenderScene()
{
g_D3DDevice->Clear(0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0,0,0), 1.0f, 0);
g_D3DDevice->BeginScene();
g_FontPosition.top = 200;
g_Font->DrawText(NULL, g_fpsStr, -1, &g_FontPosition,
DT_CENTER, D3DCOLOR_XRGB(255,255,255));
g_D3DDevice->EndScene();
g_D3DDevice-> resent(NULL, NULL, NULL, NULL);
// Get the FPS.
g_time = timeGetTime();
if(g_time - g_lastTime > 1.0f)
{
sprintf(g_fpsStr, "FPS: %d", g_fps);
g_lastTime = g_time;
g_fps = 0;
}
else
{
g_fps++;
}
} |
|