Setting up the OpenGL window
We are now going to add the code required to create an OpenGL window. We did this once for RoboRacer2D, but now, we are creating a 3D game and there will be some differences. Here's a look at what we need to do:
Include header files.
Define global variables.
Create the OpenGL window.
Initialize the OpenGL window.
Size the OpenGL window.
Remove the OpenGL window.
Create the Windows event handler.
Create the
WinMain
function.
Notice that we still have to create some code to satisfy Windows. We need an event handler to process Windows events, and we still need a main function to serve as the program entry point and run the main program loop. Everything else in this list is used to set up the OpenGL environment.
Tip
I listed the functions tasks that we need in an order that makes logical sense. When we actually implement the code, we will create things in a slightly different order. This is because some functions require another function to already be defined. For example,...