我在我的遊戲中添加了一個分析器並隔離了此功能。它有時會導致FPS下降。這是我的結果:presentRenderbuffer:GL_RENDERBUFFER_OES需要很長時間
Present buffer time: 22
Present buffer time: 1
Present buffer time: 9
Present buffer time: 1
Present buffer time: 20
Present buffer time: 6
Present buffer time: 4
Present buffer time: 4
Present buffer time: 22
Present buffer time: 4
Present buffer time: 8
Present buffer time: 4
Present buffer time: 4
Present buffer time: 15
Present buffer time: 1
Present buffer time: 1
Present buffer time: 1
Present buffer time: 11
Present buffer time: 1
Present buffer time: 6
Present buffer time: 1
Present buffer time: 1
Present buffer time: 25
Present buffer time: 6
Present buffer time: 7
Present buffer time: 1
Present buffer time: 10
Present buffer time: 7
Present buffer time: 3
Present buffer time: 1
Present buffer time: 12
Present buffer time: 9
Present buffer time: 6
Present buffer time: 9
你知道爲什麼在每隔幾幀這個功能需要更多時間嗎?
這是我的代碼:
f64 time = -System::GetTime();
[m_context presentRenderbuffer:GL_RENDERBUFFER_OES];
Log("Present buffer time: %d\n", u32((System::GetTime() + time) * 1000.));
你說得對。如果我使用glFlush(),這個函數會在常量(almoust)中執行。你知道爲什麼glFlush在不同的畫面中需要不同的時間嗎?我有相同的內容,但glFlush時間從1ms到30ms不等!感謝幫助! – Felics 2011-02-28 19:58:39
@Felics。也許一些其他的GPU任務正在運行......你是在全屏模式下工作嗎? – kvark 2011-02-28 20:33:41
此代碼在iPhone上。它是全屏的,我在一個線程中使用了opengl。我添加了與此相關的其他問題:http://stackoverflow.com/questions/5146987/glflush-time-varies-from-frame-to-frame-with-same-content-on-iphone – Felics 2011-02-28 20:40:46