diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2012-08-19 03:46:37 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2012-08-19 03:46:37 +0400 |
commit | e4a6602a9ac9c7d43a882770f19323b6d5616a4b (patch) | |
tree | 9963ab4f020db422d92671f7a6c5544c9bf5ca1d /source/gameengine | |
parent | 4120c18c47d111b6988297a3d6d4daaa7624fb43 (diff) |
Fix for [#32361] "Blenderplayer quad-buffer maximum 100Hz Fps" reported by HG1.
Allowing the Blenderplayer to break 100fps by making it less dependent on Ghost's messages.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 75 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.h | 1 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 2 |
3 files changed, 53 insertions, 25 deletions
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index eccb83fe80c..21de7011eda 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -464,31 +464,34 @@ bool GPG_Application::processEvent(GHOST_IEvent* event) handled = false; break; - case GHOST_kEventWindowUpdate: - { - GHOST_IWindow* window = event->getWindow(); - if (!m_system->validWindow(window)) break; - // Update the state of the game engine - if (m_kxsystem && !m_exitRequested) - { - // Proceed to next frame - window->activateDrawingContext(); - - // first check if we want to exit - m_exitRequested = m_ketsjiengine->GetExitCode(); - - // kick the engine - bool renderFrame = m_ketsjiengine->NextFrame(); - if (renderFrame) - { - // render the frame - m_ketsjiengine->Render(); - } - } - m_exitString = m_ketsjiengine->GetExitString(); - } - break; - + // The player now runs as often as it can (repsecting vsync and fixedtime). + // This allows the player to break 100fps, but this code is being left here + // as reference. (see EngineNextFrame) + //case GHOST_kEventWindowUpdate: + // { + // GHOST_IWindow* window = event->getWindow(); + // if (!m_system->validWindow(window)) break; + // // Update the state of the game engine + // if (m_kxsystem && !m_exitRequested) + // { + // // Proceed to next frame + // window->activateDrawingContext(); + + // // first check if we want to exit + // m_exitRequested = m_ketsjiengine->GetExitCode(); + // + // // kick the engine + // bool renderFrame = m_ketsjiengine->NextFrame(); + // if (renderFrame) + // { + // // render the frame + // m_ketsjiengine->Render(); + // } + // } + // m_exitString = m_ketsjiengine->GetExitString(); + // } + // break; + // case GHOST_kEventWindowSize: { GHOST_IWindow* window = event->getWindow(); @@ -789,6 +792,28 @@ void GPG_Application::stopEngine() m_engineRunning = false; } +void GPG_Application::EngineNextFrame() +{ + // Update the state of the game engine + if (m_kxsystem && !m_exitRequested) + { + // Proceed to next frame + if (m_mainWindow) + m_mainWindow->activateDrawingContext(); + + // first check if we want to exit + m_exitRequested = m_ketsjiengine->GetExitCode(); + + // kick the engine + bool renderFrame = m_ketsjiengine->NextFrame(); + if (renderFrame && m_mainWindow) + { + // render the frame + m_ketsjiengine->Render(); + } + } + m_exitString = m_ketsjiengine->GetExitString(); +} void GPG_Application::exitEngine() { diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h index 51dac5cb3f3..e04fcc2a555 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h @@ -77,6 +77,7 @@ public: GlobalSettings* getGlobalSettings(void); bool StartGameEngine(int stereoMode); void StopGameEngine(); + void EngineNextFrame(); protected: bool handleWheel(GHOST_IEvent* event); diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 025611972ce..63f2988e259 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -970,6 +970,8 @@ int main(int argc, char** argv) { system->processEvents(false); system->dispatchEvents(); + app.EngineNextFrame(); + if ((exitcode = app.getExitRequested())) { run = false; |