We did a lot of work creating our sprites, but nothing is going to show up until we actually render the sprites using OpenGL. Rendering is done for every frame of the game. First, an Update
function is called to update the state of the game, then everything is rendered to the screen.
Let's start by adding a call to Render
in the GameLoop
RoboRacer.cpp:
void GameLoop() { Render(); }
At this point, we are simply calling the main Render
function (implemented in the next section). Every object that can be drawn to the screen will also have a Render
method. In this way, the call to render the game will cascade down through every renderable object in the game.