Time for action — using our own rendering loop
Using the code from before we are now going to use our own rendering loop.
- Our application needs to know if it should keep running or not; add a
Boolean
as a private member of the application to remember the state:bool _keepRunning;
- Remove the
startRendering
function call in thestartup
function. - Add a new function called
renderOneFrame
, which calls therenderOneFrame
function of theroot
instance and saves the return value in the_keepRunning
member variable. Before this call, add a function to process all window events:void renderOneFrame() { Ogre::WindowEventUtilities::messagePump(); _keepRunning = _root->renderOneFrame(); }
- Add a getter for the
_keepRunning
member variable:bool keepRunning() { return ...
Get Ogre 3D 1.7 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.